So I have a datagridview in virtual mode my form, and I have a loop where I add a row to it before calling the invalidate method to get it to redraw.
It appears to run through a couple of iterations of the loop before crashing, and I never see any rows being drawn in the form. The following output is given and as you can see, the exception simply points to the initial program.cs...so that doesn't help me much in pinpointing what specific code is causing the problem:
Unhandled Exception: System.InvalidOperationException: Getting the State property of a shared row is not a valid operation.
at System.Windows.Forms.DataGridViewRow.get_State () [0x00000]
at System.Windows.Forms.DataGridView.OnPaint (System.Windows.Forms.PaintEventArgs e) [0x00000]
at System.Windows.Forms.Control.WmPaint (System.Windows.Forms.Message& m) [0x00000]
at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x00000]
at System.Windows.Forms.DataGridView.WndProc (System.Windows.Forms.Message& m) [0x00000]
at System.Windows.Forms.Control+ControlWindowTarget.OnMessage (System.Windows.Forms.Message& m) [0x00000]
at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x00000]
at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg, IntPtr wParam, IntPtr lParam) [0x00000]
at System.Windows.Forms.XplatUIX11.DispatchMessage (System.Windows.Forms.MSG& msg) [0x00000]
at System.Windows.Forms.XplatUI.DispatchMessage (System.Windows.Forms.MSG& msg) [0x00000]
at System.Windows.Forms.Application.RunLoop (Boolean Modal, System.Windows.Forms.ApplicationContext context) [0x00000]
at System.Windows.Forms.Application.Run (System.Windows.Forms.ApplicationContext context) [0x00000]
at System.Windows.Forms.Application.Run (System.Windows.Forms.Form mainForm) [0x00000]
at Venice.Program.Main () [0x0000b] in /home/johnmcd/Development/VeniceMonitor/VeniceMonitor/Program.cs:21
Is there a way I can make every row non-shared and perhaps that would fix the problem?
Thanks,
John.