Paste into bound textbox

  • Thread starter Thread starter Howard Minor
  • Start date Start date
H

Howard Minor

Not sure why this is an issue, but apparently when you paste a string into a
textbox that is bound to a dataset/datasource, it does not save into the
dataset. I've tried several things including moving the
BindingContext.Position but I haven't found an easy way short of handling
updating the dataset manually.

Anyone have any experience with this and how to get around it?

-Howard

--
 
Howard,

Mostly
Bindingcontext(dataset/datasource).endcurrentedit

I hope this helps?

Cor
 
Thanks for the quick and good response. The pasting works but what about
this scenario:

textbox1.text = textbox1.text & " new string appended"

Doesn't seem to commit that to the datasource.

hmmm...
 
Hi Howard,

I am not sure, can you try it yourself by showing the textbox first, a lot
of things to the controls start when the control is showed.

textbox1.show

Give a message when it works and as well when not?

Cor
 
Thanks again...

It's already well visible as the form is loaded. I basically have a bound
textbox and a button next to it. The button opens another module that just
returns a string selected from another form. The code then appends the new
string to the existing in the textbox using that code below. I've tried the
..AppendText function too with the same result.

The bound dataset does not update and does not show any changes. I have to
manually click in the textbox and type something for it to register.

I do have it set to multiline if that matters...

-How
 
Thanks again...

It's already well visible as the form is loaded. I basically have a bound
textbox and a button next to it. The button opens another module that just
returns a string selected from another form. The code then appends the new
string to the existing in the textbox using that code below. I've tried the
.AppendText function too with the same result.

The bound dataset does not update and does not show any changes. I have to
manually click in the textbox and type something for it to register.

I do have it set to multiline if that matters...

Had the same problem. I found just focusing the textbox forced it to update
the dataset table.

ie:

textbox1.text = "new text"
textbox1.focus()

Works but there is probably a more "correct" way to it. (I'm only just
learning VB myself :) )

Steve
 
Hi Howard,

In addition to Steve,

Normally it is better to update the datasource and not the control.

You can use the currencymanager (has nothing to do with money, manages the
current used row) for that, if you do not know how to use that message
than, than I make a very small sample.

I hope this helps?

Cor
 
Thanks, I ended up just updating the datasource rather than the control.
That makes more sense anyway.

Good tip on the focus though. I didn't think of that either.

Thanks again for the help,
Howard
 
Back
Top