techknackblogs
techknackblogs

Reputation: 131

Richtextbox Databinding issue on typing

After binding object to Richtextbox using bindingsource, if i type anything inside the textbox cursor will move to beginning. Can someone please help me.

I am binding as below

this.txtDescription.DataBindings.Add("Text", bindingWard, "Description", 
                         false, DataSourceUpdateMode.OnPropertyChanged);

Upvotes: 2

Views: 1159

Answers (3)

chrizke
chrizke

Reputation: 458

Setting formattingEnabled=true solved the problem for me.

Upvotes: 3

LarsTech
LarsTech

Reputation: 81620

Try changing the DataSourceUpdateMode to OnValidation:

this.txtDescription.DataBindings.Add("Text", bindingWard, "Description", 
                     false, DataSourceUpdateMode.OnValidation);

If you want to keep the OnPropertyChanged setting, you can try changing the ControlUpdateMode, which is sort of a way to create a one-way binding:

Binding b = new Binding("Text", test, "Description", 
                        false, DataSourceUpdateMode.OnPropertyChanged);
b.ControlUpdateMode = ControlUpdateMode.Never;
this.txtDescription.DataBindings.Add(b);

Upvotes: 2

Microsoft DN
Microsoft DN

Reputation: 10020

try richTextBox1.ScrollToEnd(); after binding

Upvotes: 0

Related Questions