So I have two combobox's. The first combobox has all the states and the second would show the districts of the selected state. Note that the options are coming from a .txt file.
So in this case the "states.txt" file is formed like "state code;state".
Ex:
01;New York
02;New Jersey
...
The state combobox is working fine, below is the code used:
List<string> States = File.ReadAllLines("states.txt").ToList();
foreach(string Line in States)
{
string[] state_element = Line.Split(';');
combo_states.Items.Add(state_element[1]);
}
The problem now is having the second combobox show the districts of the selected state.
The "district.txt" file is formed like "state code; district code; district".
Ex:
01;01;Manhattan
01;02;Brooklyn
...
Also note that I am not using any form of database, so no SQL or anything, just c# language.
See Question&Answers more detail:os