|
-
September 14th, 2010, 03:02 AM
#1
Combobox writer
Hi there,
I'm trying to do something quite simple, but I just cant figure it out.
I am trying to write all of the content in a combobox to a text file, the problem is, it just wont work as I want it it.
Here is my current code:
Code:
using (FileStream stream = new FileStream("include/bank.txt", FileMode.Create))
using (TextWriter writer = new StreamWriter(stream))
{
for (int x = 0; x <= cbBanken.Items.Count; x++ )
{
cbBanken.SelectedItem = x;
writer.WriteLine(cbBanken.SelectedItem.ToString());
}
}
At the moment it's always writing the first line in the combobox, and nothing else. I cant seem to find out what's wrong. I've tried a foreach loop too, but that didn't go too wel either.
Any help would be very much apreciate!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|