cabalsdemon
asked on
c# text files to fill combobox and listboxes
right now i am uing mysql to populate my comboboxes and listboxes
the problem with that is it takes forever and they freeze up the program even with there being a locla mysl server on my comp
what i would like to to is populate the combo and list box with text files but i need to populate like for like
first line for fisrt lines of each text file but is that going to slow the prgram down with sooo many text files
another way i can do it is via access file or sqlite file but they need to be searchable and i will need to make the file which is a very large database
the problem with that is it takes forever and they freeze up the program even with there being a locla mysl server on my comp
what i would like to to is populate the combo and list box with text files but i need to populate like for like
first line for fisrt lines of each text file but is that going to slow the prgram down with sooo many text files
another way i can do it is via access file or sqlite file but they need to be searchable and i will need to make the file which is a very large database
Hi cabalsdemon, How many entries are we talking about in the combo-box or list box? Can you share some sample data that you are trying to load in the list box/combo box?
ASKER
i am using the mysql connector to get some data and populate the list
but what is happening is it is taing forever and freezing
there was 2 combobox which it will need 2 later but
1 combobox "state"
1 listbox "city"
1 listbox "for a callsign"
and a textbox for what link the web browser needs
for the connection
here is the select
but what is happening is it is taing forever and freezing
there was 2 combobox which it will need 2 later but
1 combobox "state"
1 listbox "city"
1 listbox "for a callsign"
and a textbox for what link the web browser needs
void Fill_combobox3()
{
string constring = @"server=localhost;userid=user;password=pass";
string Query = "select distinct location from tscuscan.station where state= '" + comboBox2.SelectedItem + "'";
MySqlConnection conDataBase = new MySqlConnection(constring);
MySqlCommand cmdDataBase = new MySqlCommand(Query, conDataBase);
MySqlDataReader myReader;
try
{
conDataBase.Open();
myReader = cmdDataBase.ExecuteReader();
while (myReader.Read())
{
string sName = myReader.GetString("location");
comboBox3.Items.Add(sName);
comboBox3.SelectedIndex = 0;
comboBox3.SelectedIndexChanged += new System.EventHandler(comboBox3_SelectedIndexChanged);
}
conDataBase.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
for the connection
here is the select
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
comboBox3.Items.Clear();
Fill_combobox3();
}
ASKER
if i take the second combobox out and only do states and callsigns it still has little freeze
but i dont know what i am doing wrong
now basically its like that
and that freezing is with about 150 rows
i have pleanty more to put in
is there an easier and fresher way with access or text files
i cant figure it out
but i dont know what i am doing wrong
now basically its like that
and that freezing is with about 150 rows
i have pleanty more to put in
is there an easier and fresher way with access or text files
i cant figure it out
ASKER
anyone help please
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thank you much for that it works now
ASKER
Open in new window
is kinda what i was thinking but as the listboxselected is selected i need to search where that line is selected for the other text file