Null Reference Exception in Painting of ScrollBar of Multiline Text Box

View: New views
1 Messages — Rating Filter:   Alert me  

Null Reference Exception in Painting of ScrollBar of Multiline Text Box

by Bimal.Delhi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello I've an application which has a Multiline text box with word wrap enabled. I'm adding lines to the text box at run time. when ever the text goes beyond the visible capacity of the text box a scroll bar appears. the problem is that this scroll bar gets redrawn every time something is added and then the application crashes by giving the following exception. System.NullReferenceException: Object reference not set to an instance of an object at System.Windows.Forms.Control.PaintControlBackground (System.Windows.Forms.PaintEventArgs pevent) [0x00000] at System.Windows.Forms.Control.OnPaintBackground (System.Windows.Forms.PaintEventArgs pevent) [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.ScrollBar.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] Apart from this i periodically get the following message. i don't from where it is coming mono[376] : CGContextDrawImage: invalid context