TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Yuvraj Jambhle
NA
93
8.4k
how to write multiple functions in StreamWriter
Sep 21 2020 8:28 AM
Hello Friends,
Actually I want to know how to use multiple functions in StreamWriter, Streamwriter is used to write some selected content from the checklist box to notepad.
For ref. code
//Function 1
public void getSelectedColumnName()
{
string selectedColumn = "";
for (int i = 0; i < chkListBxColumnName.Items.Count; i++)
{
selectedColumn += chkListBxColumnName.Items[i] + ",";
}
StreamWriter SwriteData = new StreamWriter(@"C:\Users\user\Desktop\ReportTmplate\TemplateName.txt");
}
//Function 2
public void getSelectedTableName()
{
string selectedColumn = "";
for (int i = 0; i < chkListBxTableName.Items.Count; i++)
{
selectedColumn += chkListBxTableName.Items[i] + ",";
}
StreamWriter SwriteData = new StreamWriter(@"C:\Users\user\Desktop\ReportTmplate\TemplateName.txt");
}
//Now I want to call these above 2 functions in stream writer
private void btnWriteData_Click(object sender, EventArgs e)
{
using (StreamWriter write = new StreamWriter(@"C:\Users\user\Desktop\ReportTmplate\Template.txt"))
{
write.WriteLine(lblDBFileName.Text + " [" + cmbDBFileName.Text + "]\n");
write.WriteLine(lblDbTableName.Text + " [" + cmbDbTableName.Text + "]\n");
// Now Inside this function block, I want to use Function 1 & Function 2, below the above line.
//So please how can use this function here.
}
}
Reply
Answers (
1
)
How to connect to SQL Server data without using SQL Server Management
I need help in understanding a C# Code