I am a little better perhaps at VBA than I am c# - a learning process.
In VBA, I am able to connect 3 different textboxes, so that when you select an item in ListBox1 both ListBox2 and ListBox3 populate with the corresponding items (which are then transferred to texboxes for the program to act upon them)
I can do this using ListIndex, but I have not found anything similar in C#. The data comes from a table of 3 columns and are equal in length and the data at entry 4 in Column A corresponds with the data in entry 4 of Column B.
So I have the usual SQL connection code and then
I have code that allows me to filter by text on listbox1 and listbox2 (listbox3 is actually hidden as I only need the output).
I have looked at the SelectedIndex documentation from MSDN - which works if you have two identical items as it simply searches for the item in the second listbox. But I have Employee ID and Employee Name for example.
I have seen some rather convoluted methods while searching online, which would require me to re-write my entire code base and given that this is the last piece that I need...I would like to avoid re-writing the entire code. Happy to make changes, but would be relieved if those changes were limited.
If you are aware of a ListIndex for C# point me at it, I can usually read up and get something working....but I have spent the last 3 hours googling this problem and I have not found anything that would do the same job.
In VBA, I am able to connect 3 different textboxes, so that when you select an item in ListBox1 both ListBox2 and ListBox3 populate with the corresponding items (which are then transferred to texboxes for the program to act upon them)
I can do this using ListIndex, but I have not found anything similar in C#. The data comes from a table of 3 columns and are equal in length and the data at entry 4 in Column A corresponds with the data in entry 4 of Column B.
So I have the usual SQL connection code and then
C#:
While (dr.Read())
{
listbox1.Items.Add(dr["Item1"]);
listbox2.Items.Add(dr["Item2"]);
listbox3.Items.Add(dr["Item3"]);
}
I have code that allows me to filter by text on listbox1 and listbox2 (listbox3 is actually hidden as I only need the output).
I have looked at the SelectedIndex documentation from MSDN - which works if you have two identical items as it simply searches for the item in the second listbox. But I have Employee ID and Employee Name for example.
I have seen some rather convoluted methods while searching online, which would require me to re-write my entire code base and given that this is the last piece that I need...I would like to avoid re-writing the entire code. Happy to make changes, but would be relieved if those changes were limited.
If you are aware of a ListIndex for C# point me at it, I can usually read up and get something working....but I have spent the last 3 hours googling this problem and I have not found anything that would do the same job.