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
Behrouz Hosseini
NA
72
0
Load from Text file into ComboBox
Jul 6 2010 2:42 PM
Hi Guys,
I am trying to load a combobox from a text file (Test.txt).Every thing goes fine while I capture the elements in Test.txt line by line like:
One
Two
Three
but when I store a the elements as a CSV format like
One, Two, Three
the combo box return all of them in one line.
Could you please let me know how should I modify the code to be able to seperate elements by comma?
private void btnLoad_Click(object sender, EventArgs e)
{
string path = "D:\\Test.txt";
StreamReader sr = new StreamReader(path);
while (sr.Peek() >= 0)
{
comBox.Items.Add(sr.ReadLine());
}
comoBox.SelectedIndex = -1;
}
Best Regards
Reply
Answers (
2
)
C#.net 2008 configuration file
getting page number when reading file by paragraphs