Comboobx pulldown problem
-
Hi friends , I am using visual studio 2003.In my project I have a combobox populated directly from a dataset using 'displaymember' and 'valuemember' properties.But sometimes my combobox is hanging ie , it can be selected with scroll of mouse but pulldown is not working.Any way to correct this issue friends ? with warm regards
-
Hi friends , I am using visual studio 2003.In my project I have a combobox populated directly from a dataset using 'displaymember' and 'valuemember' properties.But sometimes my combobox is hanging ie , it can be selected with scroll of mouse but pulldown is not working.Any way to correct this issue friends ? with warm regards
I think the way you handle your comboboxes coding are everthing but warm, cold or freezing instead :laugh: But (only) because your regards are warm, i´m going to post you this routine. I assume you know display_member is like country_name(varchar) and value_member is like id_country(int), and you made a store_procedure to fill the combobox (select id_country,country_name FROM dbo.Countries):-D Good Warm Luck:cool:
public static void ComboBox_Fill(ComboBox myComboBox,
string store_procedure, string display_member,
string value_member)
{
SqlConnection sql_conn = new SqlConnection(connection_string);
SqlCommand sql_cmd = new SqlCommand();
sql_cmd.Connection = sql_conn;
sql_cmd.CommandText = store_procedure;
sql_cmd.CommandType = CommandType.StoredProcedure;
sql_conn.Open();
SqlDataAdapter sql_da = new SqlDataAdapter();
sql_da.SelectCommand = sql_cmd;
DataTable dt = new DataTable();
sql_da.Fill(dt);
sql_conn.Close();
myComboBox.DataSource = dt;
myComboBox.DisplayMember = display_member;
myComboBox.ValueMember = value_member;
}nelsonpaixao@yahoo.com.br trying to help & get help
-
I think the way you handle your comboboxes coding are everthing but warm, cold or freezing instead :laugh: But (only) because your regards are warm, i´m going to post you this routine. I assume you know display_member is like country_name(varchar) and value_member is like id_country(int), and you made a store_procedure to fill the combobox (select id_country,country_name FROM dbo.Countries):-D Good Warm Luck:cool:
public static void ComboBox_Fill(ComboBox myComboBox,
string store_procedure, string display_member,
string value_member)
{
SqlConnection sql_conn = new SqlConnection(connection_string);
SqlCommand sql_cmd = new SqlCommand();
sql_cmd.Connection = sql_conn;
sql_cmd.CommandText = store_procedure;
sql_cmd.CommandType = CommandType.StoredProcedure;
sql_conn.Open();
SqlDataAdapter sql_da = new SqlDataAdapter();
sql_da.SelectCommand = sql_cmd;
DataTable dt = new DataTable();
sql_da.Fill(dt);
sql_conn.Close();
myComboBox.DataSource = dt;
myComboBox.DisplayMember = display_member;
myComboBox.ValueMember = value_member;
}nelsonpaixao@yahoo.com.br trying to help & get help
Brother , Thanxxxxx a lot for your reply.The same code I used in my project.Yaa but the problem was with frame work.I converted project in to VS 2005.It is working fine there.Also conversion cleared a lots of unhandled exceptions in my project.Once again thanxx for your reply...Take care