Combobox Datagridview问题 [英] Combobox Datagridview prob
问题描述
很高兴,我的项目3 f dem中有datagridview(dgv).
在我的btn上填充了第一个gridview,
我需要在第二个dgv中选择值,并基于第二个
中选择的值
第三个dgv被填充.
我的问题是我在第二个dgv的combox中选择值,然后按Enter键进入
光标移到我的第三个dgv中传递了谁的索引的下一行.
PL的帮助.非常紧急.
我尝试使用第二个dgv的KeyDown事件,但是在组合框选择输入时未触发.
Het frnds,I have datagridview(dgv) in my project 3 f dem.
the first gridview gets populated on my find btn,
I need to select values in my 2nd dgv and on the basis of the value selected in 2nd
the 3rd dgv gets filled.
My prob is dat wen i select value in the combox in 2nd dgv n press enter it goes
the cursor goes on the next row whos index is passed in my 3rd dgv.
PLs help.Its urgent.
I tried using the KeyDown event of 2nd dgv but it doesnt get fired on enter of the combobox selection.
推荐答案
hi
用这个
this.dgvacc_InvChild.CellLeave + =新的DataGridViewCellEventHandler(dgvacc_InvChild_CellLeave);
私有void dgvacc_InvChild_CellLeave(对象发送者,DataGridViewCellEventArgs e)
{
int ncolumn = dgvacc_InvChild.CurrentCell.ColumnIndex;
开关(ncolumn)
{
情况1:
GetStockItemFullName();
休息;
情况2:
休息;
情况3:
CalculateCounterValue();
CalculateTotalValue();
休息;
情况4:
CalculateCounterValue();
CalculateTotalValue();
休息;
情况5:
CalculateCounterValue();
CalculateTotalValue();
休息;
案例6:
休息;
案例7:
CalculateTotalValue();
休息;
案例8:
休息;
默认值:
//MessageBox.Show("default);
休息;
}
}
hi
use this
this.dgvacc_InvChild.CellLeave += new DataGridViewCellEventHandler(dgvacc_InvChild_CellLeave);
private void dgvacc_InvChild_CellLeave(object sender, DataGridViewCellEventArgs e)
{
int ncolumn = dgvacc_InvChild.CurrentCell.ColumnIndex;
switch (ncolumn)
{
case 1:
GetStockItemFullName();
break;
case 2:
break;
case 3:
CalculateCounterValue();
CalculateTotalValue();
break;
case 4:
CalculateCounterValue();
CalculateTotalValue();
break;
case 5:
CalculateCounterValue();
CalculateTotalValue();
break;
case 6:
break;
case 7:
CalculateTotalValue();
break;
case 8:
break;
default:
//MessageBox.Show("default");
break;
}
}
这篇关于Combobox Datagridview问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!