Here's the full stack trace:
Unhandled Exception: System.NullReferenceException: Object reference not
set to an instance of an object.
at System.Windows.Forms.RichTextBox.EditStreamProc(In tPtr dwCookie,
IntPtr buf, Int32 cb, Int32& transferred)
at System.Windows.Forms.UnsafeNativeMethods.CallWindo wProc(IntPtr
wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at System.Windows.Forms.NativeWindow.DefWndProc(Messa ge& m)
at System.Windows.Forms.Control.DefWndProc(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.TextBoxBase.WndProc(Message& m)
at System.Windows.Forms.RichTextBox.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage (Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(M essage& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.PeekMessa ge(MSG& msg,
HandleRef hwnd, Int32 msgMin, Int32 msgMax, Int32 remove)
at SystThe program '[3208] TKSAdmin.exe' has exited with code 0 (0x0).
em.Windows.Forms.ComponentManager.System.Windows.F orms.UnsafeNativeMethods+IMsoComponentManager.FPus hMessageLoop(Int32
dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.ThreadContext.RunMessageLoopI nner(Int32
reason, ApplicationContext context)
at System.Windows.Forms.ThreadContext.RunMessageLoop( Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at TKSAdmin.Globals.Main()
Benny Raymond wrote:
Sequencially is fine... but now i run into another problem...
inside of the function that gets fired in the main form when the said
event takes place, I have the following line:
if (this.txt_log.Text.Length > 1024*60)
it's checking to see if the text in a rich text box is larger than 60k.
After the event is fired a bunch of times really fast, the program
crashes here and returns just after the
System.Windows.Forms.Application.Run(new frmMain());
inside Main saying that an Object Refrence not set to an instance of an
object... I had to step through my code to find out where it was
crashing... and when I mouse over .Length while stepping through Visual
Studio freezes up for a good 10 seconds and then displays no information
about .Length
Any idea what would be causing this?
Truong Hong Thi wrote:
Just remember that if there are more than one items in the
invocation list inside of the event (see GetInvocationList of the event)
that you have to iterate through them all and call BeginInvoke on each.
I think you don't need that unless you want _each_ registered handler
to be run on its own thread. Normally, calling BeginInvoke on the event
is adequate, and all the registered handlers will be invoked
sequecially on a same separate thread.
Thi