Hi,
I try to do a winform C# (2005) and update an item in Grid.
The 1st column, I have a combobox so I want update all item in Grid when I change value in comboboxes.
Could everyone give me an example? Thanks in adv

Recommended Answers

All 4 Replies

Thanks Amir S.Bedair

That is usefull for me, I will read and try to do my problems, if I have any question I will reply you for helping.

I try to do a winform C# (2005) and update an item in Grid.
The 1st column, I have a combobox so I want update all item in Grid when I change value in comboboxes.
Could everyone give me an example? Thanks in adv

example:

/* databasename to sql=behdari
tabelname to sql=tblshagel */
string SQLCON = "SERVER=(LOCAL);DATABASE=BEHDARI;iNTEGRATED
SECURITY=TRUE;";
string strSQL = string.Format("SELECT * FROM tblSHaghel WHERE family
LIKE'%{0}%'", combobox1.Text);
behdariDataSet1.tblSHaghel.Clear();
SqlDataAdapter dadp = new SqlDataAdapter(strSQL, SQLCON);
dadp.Fill(behdariDataSet3.tblSHaghel);

You can use the ComboBox class SelectedIndexChanged or SelectedValueChanged Events. Once the event is generated, you can update the DataSet and then display the data in the DataGrid.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.