RichTextBox.Text Value Reverting

stewarts

Newcomer
Joined
Apr 8, 2003
Messages
22
I have a vb .net windows form with a tabcontol. On TabPage1 I have a RichTextBox. The TEXT property of the RichTextBox is bound to a database field. The user can change the text contents of the RichTextBox by typing in the field, cutting/pasting, etc. I then use an update routine to update the database. All that works like a champ. If I type in the RichTextBox field, then change to TabPage2, and back again to TabPage1, the changed value I typed is still there in the RichTextBox.
However, if I change the value of the RichTextBox by setting the TEXT property thru the code, then change to TabPage2, and back again to TabPage1, the value reverts to the original database value (or the last value typed in the field).
I have to be able to set the TEXT value thru code because there is a spell check function on the field.
Can anyone please give me a clue what I need to do to keep the value from reverting? THANK YOU SO MUCH!!!!!
 
Found Solution

I found a solution to this...If after setting the .text property, I set focus (RichtextBox1.Focus() ) before changing to another TabPage, the set value is retained. Don't know why, but it worked!!
 
Back
Top