首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

comboBox1_SelectedIndexChanged事件,该如何解决

2012-09-10 
comboBox1_SelectedIndexChanged事件如上图:radiobutton_checkedchanged事件与comboBox1_SelectedIndexCha

comboBox1_SelectedIndexChanged事件


如上图:radiobutton_checkedchanged事件与comboBox1_SelectedIndexChanged事件,相结合

C# code
private void radioButton318_CheckedChanged(object sender, EventArgs e)        {            if (tmpRadio != null)            {                tmpRadio.Checked = false;            }            tmpRadio = (sender as RadioButton);            if (radioButton318.Checked)            {               clsGridStyle.rdo318();               clsCellCompute.rdo318();                               List.OwnerDrawCell += new FlexCell.Grid.OwnerDrawCellEventHandler(clsDrawBrokenline.rdo318);               List.OwnerDrawCell += new FlexCell.Grid.OwnerDrawCellEventHandler(clsDrawImage.rdo318);            }            else            {                List.OwnerDrawCell -= new FlexCell.Grid.OwnerDrawCellEventHandler(clsDrawBrokenline.rdo318);                List.OwnerDrawCell -= new FlexCell.Grid.OwnerDrawCellEventHandler(clsDrawImage.rdo318);             }        }


F5调试的时候,执行上面的代码,进行关于“7”的查询
触发comboBox1_SelectedIndexChanged后
radioButton318 处于unchecked状态,怎么回事呢?



C# code
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)        {            //        }


comboBox1_SelectedIndexChanged事件里的代码该如何写呢?谢谢

[解决办法]
你这代码根本就不对。

List.OwnerDrawCell -= new FlexCell.Grid.OwnerDrawCellEventHandler(clsDrawBrokenline.rdo318);
根本就不能移除你之前添加的事件处理函数。

热点排行