I did it and there is not error messages, but what I need to do to see the NationSelector combobox in the toolbox? because I compile the code and It does not appear. Thanks.
adrian salas
Posts
-
how to fill a combobox with a class -
how to fill a combobox with a classHi, I did it as you told me: protected override void OnLoad(object sender, EventArgs e) { BDconexion bdConex = new BDconexion(); string nacionalidad = "select * from cs_nacionalidad"; try { //open connection bdConex.OpenConnection(); //create command and assign the query and connection from the constructor MySqlDataAdapter da = new MySqlDataAdapter(nacionalidad, bdConex.conn); //create dataset DataSet ds = new DataSet(); // filling dataset da.Fill(ds, "cs_nacionalidad"); //dataset values NationSelector1.DataSource = ds.Tables["cs_nacionalidad"]; NationSelector1.DisplayMember = "nm_nacionalidad"; NationSelector1.ValueMember = "cd_nacionalidad"; //close connection bdConex.CloseConnection(); } catch (Exception ex) { MessageBox.Show(ex.Message); } But I am having problem with these lines: NationSelector1.DataSource = ds.Tables["cs_nacionalidad"]; NationSelector1.DisplayMember = "nm_nacionalidad"; NationSelector1.ValueMember = "cd_nacionalidad"; what is the name that I should write instead of NationSelector1? thanks.
-
how to fill a combobox with a classhow do I call the class with the combobox as a parameter? Thanks
-
how to fill a combobox with a classHi, I am filling a combobox with the code below: private void frmCrearCooperativa_Load(object sender, EventArgs e) { string nacionalidad = "select * from cs_nacionalidad"; try { //open connection bdConex.OpenConnection(); //create command and assign the query and connection from the constructor MySqlDataAdapter da = new MySqlDataAdapter(nacionalidad, bdConex.conn); //create dataset DataSet ds = new DataSet(); // filling dataset da.Fill(ds, "cs_nacionalidad"); //dataset values cboNacionalidad.DataSource = ds.Tables["cs_nacionalidad"]; cboNacionalidad.DisplayMember = "nm_nacionalidad"; cboNacionalidad.ValueMember = "cd_nacionalidad"; //close connection bdConex.CloseConnection(); } catch (Exception ex) { MessageBox.Show(ex.Message); } how do I can do a class that fills the combobox with this code? because I have to write it down in all forms. thanks.
-
C# sessionI mean Roles, I want that some users can see an especific window and someone diferente can not do it.
-
C# sessionHello, I am trying to make and c# application using sessions to control the app access, somebady knows how to do it? Regards.