473,383 Members | 1,862 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

RichTextBox access error ?

Hello
I have some Threads, and they write something to
RichTextBox.Text property. But sometimes i receive error:

************** Exception Text **************
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.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)

Why ? Is it problem with synchronization: that many threads try to
change Text property at the same time, or what ?
How can i solve this problem ?

Thanx
Michal

Nov 16 '05 #1
1 2095
vertigo,

if you access any UI control from threads you might have similar problems.
Most of UI controls are single-threaded by definition and you can safely
access them only from UI thread.

HTH
Alex
"vertigo" <ax***@wp.pl> wrote in message
news:cn**********@nemesis.news.tpi.pl...
Hello
I have some Threads, and they write something to
RichTextBox.Text property. But sometimes i receive error:

************** Exception Text **************
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.Callback(IntPtr hWnd, Int32
msg, IntPtr wparam, IntPtr lparam)

Why ? Is it problem with synchronization: that many threads try to
change Text property at the same time, or what ?
How can i solve this problem ?

Thanx
Michal

Nov 16 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: KenH | last post by:
I am getting an unhandled system exception while writing to a RichTextBox. The process may run for a few hours or days before the error is generated The message is "Cannot access a disposed object...
1
by: Nathan Carroll | last post by:
In an mdi environment I constructed a child for with a richtextbox control that is used to load .rtf's. This works fine on the intiatial load of the form but when for is closed and reopened later...
2
by: Dave | last post by:
I have a button on a form that calls a function. The function does some stuff and then I want it to write the results to a richTextBox. The problem is the code; richTextBox1.Text += "Results"; ...
5
by: mthgk | last post by:
I have a C# MDI app. The child forms do alot of work, so this work is perfomed on a different thread created using ThreadPool.QueueUserWorkItem(). Because the status of the work is important to...
1
by: Eric | last post by:
Using the 1.1 framework. We are using a newly created instance of a RichTextBox Class in our server code to manipulate RTF that is stored in the database. To clarify, we are not using or...
0
by: y2k692hu | last post by:
Hello I am trying to run this and I keep getting a "SystemNullReferenceException: Object reference not set to instance of an object" error. I have three menu items bold, italic and underline. When i...
0
by: James Manila Dot Net | last post by:
I've been having a major problem using the Rtf property of the Richtextbox. I use the RTB to generate RTF code to save it in an access database. I'm successfully able to do this. However, the...
1
by: gazelle04 | last post by:
I'm trying to use the "RichTextBox" control so that I can have a text box where you can format the selected text's font, size, and colors but when I insert that Active X control it gives an error...
5
by: Andrus | last post by:
I use Winforms RichTextBox control to edit scripts. Scripts are plain ascii texts. When error occurs, script engine returns character position of error in code as integer. How to position...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.