BUG01:打开子窗体(sender as ToolStripMenuItem)是null,取不到权限
作者:C/S框架网  发布日期:2011/04/25 16:30:00
BUG01:打开子窗体(sender as ToolStripMenuItem)是null,取不到权限

今天在测试权限管理时找到一个BUG, 菜单的Click事件sender参数为null, 于是sender as ToolStripMenuItem
转换后的值也是null, 在OpenChildForm方法内的IPurviewControllable 接口无法取到权限值.


//错误的写法

private void menuSalesOrder_Click(object sender, EventArgs e)

{

  MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(frmSO), sender as ToolStripMenuItem);

}

 


//正确的写法

private void menuSalesOrder_Click(object sender, EventArgs e)

{

  MdiTools.OpenChildForm(this.MdiParent as IMdiForm, typeof(frmSO), menuSalesOrder); //指定菜单名

}


上一篇 下一篇