Frage

Im using Visual Basic 2010 and I have a Binding navigator which changes the numbers in text boxes which are linked to the database.

I also have a button (Button1) which when pressed, uses the numbers in these text boxes for calculations. I need the button to be automatically pressed when the 'bindingnavigatormovenextitem' button is pressed, however the following code presses the button BEFORE the textboxes have updated to the next set of data.

Therefore, I need a code which presses the button once the textboxes have been updated.

Here is the current code:

Private Sub BindingNavigatorMoveNextItem_Click(ByVal sender As System.Object, ByVal e  As System.EventArgs) Handles BindingNavigatorMoveNextItem.Click

    Button1.PerformClick()

End Sub

Any help would be very much appreciated :) Thank you!

War es hilfreich?

Lösung

You can use BeginInvoke to run the code after the method is done:

Me.BeginInvoke(New Action(Sub() Button1.PerformClick()))
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top