我用c#做的是检查用户权限设置菜单是否可用,但是转换菜单目录类型出错
详细的错误提示如下:
System.InvalidCastException
HResult=0x80004002
Message=无法将类型为“System.Windows.Forms.ToolStripSeparator”的对象强制转换为类型“System.Windows.Forms.ToolStripDropDownItem”。
Source=RTS2MainApp
StackTrace:
at RTS2MainApp.ModuleClass.MyModule.MainMenuF(MenuStrip MenuS) in C:UserswangjiaDesktopwjATE1MainAppModuleClassMyModule.cs:line 716
at ATE1MainApp.MainForm.Preen_Main() in C:UserswangjiaDesktopwjATE1MainAppMainForm.cs:line 33
at ATE1MainApp.MainForm.MainForm_Load(Object sender, EventArgs e) in C:UserswangjiaDesktopwjATE1MainAppMainForm.cs:line 223
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)