K
kohoutec
[Newbie Alert]
I have a combobox that populates its items from a text file when its form
loads. I have added to one of my buttons click events some code to add any
entrys that are manually entered to the combo - something along the lines
of:
cboProcess.Items.Add(cboProcess.Text);
This all works fine. What I want to be able to do is give the user an
option to save the contents of the combo box back to the text file, so
that the next time they run the app any manually added entrys are there.
The code I used to read the file uses a Streamreader, I sort of hacked it
together by reading a couple of webpages - (I'm very much a beginner.) Now
I assume I should be using a Streamwriter to write the file back, but I
cant figure out how to iterate through the combobox contents to write it
back, any help greatly appreciated.
Jon
I have a combobox that populates its items from a text file when its form
loads. I have added to one of my buttons click events some code to add any
entrys that are manually entered to the combo - something along the lines
of:
cboProcess.Items.Add(cboProcess.Text);
This all works fine. What I want to be able to do is give the user an
option to save the contents of the combo box back to the text file, so
that the next time they run the app any manually added entrys are there.
The code I used to read the file uses a Streamreader, I sort of hacked it
together by reading a couple of webpages - (I'm very much a beginner.) Now
I assume I should be using a Streamwriter to write the file back, but I
cant figure out how to iterate through the combobox contents to write it
back, any help greatly appreciated.
Jon