Hi,
I loaded the data from database to listbox in my form. (every time it retrieves different number from the database)
now my listbox contains items as follows: (1st time:)
1021
1022
1023
later my listbox contains like this:
1021
1023
I have a text file like this: (I have almost 1000 rows here i am giving you only 3 rows)
1021 darma
1022 teja
1023 vulpes
Now i want to change my listbox numbers as follows:
1st time listbox should show like this:
darma
teja
vulpes
2nd time listbox should show like this:
darma
vulpes
Give me ideas to do.
Thanks allot
Darma
Loading
VulpesPosted May 16, 2012, 10:40 AM
Here's a modification to the previous code to deal with that:
darma tejaPosted May 16, 2012, 11:19 AM
You are genius man.
Darma
darma tejaPosted May 16, 2012, 10:32 AM
Thanks allot once again.
I am getting exception at the line: dict.Add(items[0], items[1]);
The exception is like this: "An item with the same key has already been added"
Darma
VulpesPosted May 16, 2012, 9:59 AM
May be like this:
darma tejaPosted May 16, 2012, 9:40 AM
Thanks allot for your reply.
Your code is to get all the names in listbox.
Actually i should not get all the names in my listbox.
These list box items are retrieved from other list box selected index changed event.
Now my list box get different numbers in different times based on other list box selected index changed event.
Based on the listbox numbers, i will change in names automatically.
Darma
VulpesPosted May 16, 2012, 8:49 AM
listBox1.DataSource = names;
This assumes there are no blank lines in the file.