there is a data grid view with columns item ,quantityleft,q uantity,unit,pr ice per unit,discount
from these "item" is combobox which must be defined from a table "stock" having columns iname,iid,etc
iname should come in the combobox.
how should i do it have tried both combobox column and combobox cell.
private void sell_Load(objec t sender, EventArgs e)
{
//dataGridView1.S electedColumns.
SqlDataAdapter adapter1 = new SqlDataAdapter( "select * from [stock] where uid =" + id+"and compid="+cid, con);
DataSet ds2 = new DataSet();
SqlCommandBuild er cmd1 = new SqlCommandBuild er(adapter1);
adapter.Fill(ds 2, "[stock]");
//DataGridViewCom boBoxColumn i = new DataGridViewCom boBoxColumn();
/////DataGridViewCom boBoxColumn dd = dataGridView1.C olumns[0];
//i.DataSource = ds2;
//DataGridViewCom boBoxCell dd = (DataGridViewCo mboBoxCell)data GridView1.Rows[0].Cells[0];
DataGridViewCom boBoxColumn dd = (DataGridViewCo mboBoxColumn)da taGridView1.Col umns["item"];
dd.DataSource = ds2;
//dd.
//dd.DisplayMembe r = "iname";
//dd.ValueMember= "iname";
}
from these "item" is combobox which must be defined from a table "stock" having columns iname,iid,etc
iname should come in the combobox.
how should i do it have tried both combobox column and combobox cell.
private void sell_Load(objec t sender, EventArgs e)
{
//dataGridView1.S electedColumns.
SqlDataAdapter adapter1 = new SqlDataAdapter( "select * from [stock] where uid =" + id+"and compid="+cid, con);
DataSet ds2 = new DataSet();
SqlCommandBuild er cmd1 = new SqlCommandBuild er(adapter1);
adapter.Fill(ds 2, "[stock]");
//DataGridViewCom boBoxColumn i = new DataGridViewCom boBoxColumn();
/////DataGridViewCom boBoxColumn dd = dataGridView1.C olumns[0];
//i.DataSource = ds2;
//DataGridViewCom boBoxCell dd = (DataGridViewCo mboBoxCell)data GridView1.Rows[0].Cells[0];
DataGridViewCom boBoxColumn dd = (DataGridViewCo mboBoxColumn)da taGridView1.Col umns["item"];
dd.DataSource = ds2;
//dd.
//dd.DisplayMembe r = "iname";
//dd.ValueMember= "iname";
}
Comment