Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
630
Problem with UltraCombo and Moving to Next Control on Form
posted

Recently, I had a request from a user that when they selected a row in an UltraCombo control the focus would automatically move to the next control on the form. Here is the code I am using:

Private Sub ucboDataClassCode_RowSelected(ByVal sender As System.Object, ByVal e As Infragistics.Win.UltraWinGrid.RowSelectedEventArgs) Handles ucboDataClassCode.RowSelected

 

    Try

        Me.SelectNextControl(Me.ActiveControl, True, True, True, True)

    Catch ex As Exception

        MessageBox.Show(ex.Message & vbCrLf & vbCrLf & ex.StackTrace, Me.Text, MessageBoxButtons.OK, MessageBoxIcon.Error)

    End Try

 

End Sub

But after I added this code we noticed that the control was no longer updating the row/column in the datatable and consequently the data was not being updated to the table in SQL Server on the save.

So I add this line of code to the event with no change, the control was still not updating the datatable it was bound to.

Me.ucboDataClassCode.UpdateData()

What can I do to fix this?

 

 

 

 

  • 469350
    Suggested Answer
    Offline posted

    Hi James,

    I can't be sure about this, but my best guess is that the BindingManager is not updating the underlying data source because the control is losing focus before the Value is updated. I have noticed cases in the past where the BindingManager does not response to the setting of a value when the control is not currently active. I guess is does this on the assumption that you only want to pick up changes made by the user.

    If that's the case, then one way you might be able to get around it is to move the code from the RowSelected event into a separate method. Then, in the RowSelected event, you would call that method using a BeginInvoke instead of calling the method directly. This should create a delay before the code executes so that the Value of the control is updated before the SelectNextControl call is executed.