关于radioButton1_CheckedChanged(radioButton1, null)
有4个radiobutton: radiobutton1、radiobutton2、radiobutton3、raditobutton4 之间切换没有任何问题,一切OK
- C# code
private void radioButton4_CheckedChanged(object sender, EventArgs e){ if (radioButton4.Checked) { //表格设计(单元格合并、计算、绘制图片等) } else { //表格初始化 }
但是,在从“数据库维护”窗体退出后,执行下列代码后
- C# code
if (Manual.ShowDialog() == DialogResult.OK){ binddata();//重新刷新 radioButton4_CheckedChanged(radioButton4, null);}
从radiobutton4切换至 radiobutton1或radiobutton2或radiobutton3,发生报错,
(类推:radiobutton1切换至其它rdo,发生同样报错)
主要是因为 表格的单元格计算没有发生,这是为什么呢?
[解决办法]
- C# code
radioButton4_CheckedChanged(radioButton4, null);你这句都执行了radioButton4_CheckedChanged事件,直接是在表格设计,,表格根本没没有初始化,,,,private void radioButton4_CheckedChanged(object sender, EventArgs e){ if (radioButton4.Checked) { //表格设计(单元格合并、计算、绘制图片等) } else { //表格初始化 }}
[解决办法]
radioButton4.checked=true;
radioButton4_CheckedChanged(null, null);
试试看