我们可以检查4个组合框中组合框的选项卡索引,并希望在组合框上创建条件(如果没有)

时间:2014-01-16 06:33:50

标签: c#

我想使用tab索引来检查选项卡索引在组合框中的位置...我也想为此做个条件

if(combobox1 == tabindex) // check data is already in database or not
{
   get data on dridview according to combobox1.Text
}
else if(combobox 2 == tabindex) // check data is already in database or not   
{
   get data on dridview according to combobox2.Text
}
else if(combobox 3 == tabindex) // check data is already in database or not 
{
   get data on dridview according to combobox3.Text
}

这可能吗?

1 个答案:

答案 0 :(得分:0)

试试这个

var a = Form1.getActiveTab();
var idx = Form1.items.indexOf(a);