Delay running query

I have a combo box that when I select and index I need it to wait until Textbox 2 is REpopulated with the new value before it fires.  How can I accomplish.


   Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
 *******************************
   need to wait until textbox 2 is populated.
         Me.RunQuery()
    End Sub

Thanks
running32Asked:
Who is Participating?
 
iboutchkineConnect With a Mentor Commented:
in Textbox2 Change event add global boolean var that you will set to true on change event. then

  Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
 *******************************
if bool = True then
  bool = False
         Me.RunQuery()
end if
    End Sub

0
 
running32Author Commented:
Can you tell me what you mean by setting the global bolean to var.  When I add this statement I get runtime errors on bool.

Thanks
0
 
iboutchkineCommented:
you memorize the repopulation of textbox2 and run query only if it happened
0
 
running32Author Commented:
Got it.  Thanks for the help iboutchkine.  

I changed it to the code below and it works great......

 Private Sub ComboBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged

        bool = True
     
    End Sub

 
    Private Sub TextBox5_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox5.TextChanged
        If bool = True Then
            bool = False
            Me.RunQuery()
        End If
    End Sub
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.