本文介绍了datagridview中的组合框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我在datagridview中绑定数据的代码.
here is my code for binding data in datagridview...........
if (con.State == ConnectionState.Closed)
{
con.Open();
}
string sqlqry = "SELECT ITEMCODE, BROKTYPE,BROKRATE,TRANRATE,TranType,uptostdt,MARTYPE,MARRATE,PARTYTYPE FROM PITBROK";
SqlDataAdapter da = new SqlDataAdapter(sqlqry, con);
DataSet ds1 = new DataSet();
da.Fill(ds1, "PITBROK");
//if (ds1.Tables[0].Rows.Count > 0)
for (int i = 0; i < ds1.Tables[0].Rows.Count; i++)
{
dataGridView1.ColumnCount = 9;
dataGridView1.Rows.Add();
dataGridView1[0, i].Value = ds1.Tables[0].Rows[i][0].ToString();
string b = ds1.Tables[0].Rows[i][1].ToString();
if (b == "O")
{
dataGridView1[1, i].Value = "Opening Sauda";
}
else if (b == "P")
{
dataGridView1[1, i].Value = "Persentage Wise";
}
else if (b == "T")
{
dataGridView1[1, i].Value = "Transation";
}
dataGridView1[2, i].Value = ds1.Tables[0].Rows[i][2].ToString();
dataGridView1[3, i].Value = ds1.Tables[0].Rows[i][3].ToString();
string l = ds1.Tables[0].Rows[i][4].ToString();
if (l == "O")
{
dataGridView1[4, i].Value = "Opening Sauda";
}
else if (l == "P")
{
dataGridView1[4, i].Value = "Persentage Wise";
}
else if (l == "T")
{
dataGridView1[4, i].Value = "Transation";
}
dataGridView1[5, i].Value = ds1.Tables[0].Rows[i][5].ToString();
string m = ds1.Tables[0].Rows[i][6].ToString();
if (m == "Q")
{
dataGridView1[6, i].Value = "Qty Wise(perunit)";
}
else if (m == "V")
{
dataGridView1[6, i].Value = "Value Wise(in%)";
}
else if (m == "I")
{
dataGridView1[6, i].Value = "Import Rates";
}
else if (m == "C")
{
dataGridView1[6, i].Value = "Client Wise Margine";
}
dataGridView1[7, i].Value = ds1.Tables[0].Rows[i][7].ToString();
dataGridView1[8, i].Value = ds1.Tables[0].Rows[i][8].ToString();
}
现在我要在datagridview中显示的数据只一次在一个单元格中以broktype组合框,因为按下回车键(组合框包含诸如item1项目b项目c ..等等的项目.)
我必须做的是,请帮助我..............请拜托请拜托请拜托请拜托请拜托请拜托请
我的emailid [email protected]
data shown in datagridview now i want to combo box in broktype at a time only in one cell as enter key is press (combo box contain item like item1 item b item c..and so on....)
what i have to do please help me ..........please please please please please please please please please please please please please please
my emailid [email protected]
推荐答案
这篇关于datagridview中的组合框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!