Click here to Skip to main content
15,902,032 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Private Sub cb_party_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles cb_party.GotFocus
               If cb_from.Text = cb_to.Text Then
            MsgBox(" From and To doesn't same")
        End If
    End Sub

while running this code, msgbox display. but click OK button in the message box, that box won't close. if we try to close means, it won't close. how to solve this.....
Posted
Updated 16-May-12 21:59pm
v2
Comments
Jim Jos 17-May-12 4:01am    
Got focus event is repeating!! Did you check about it.. If you want use Debug.print to check any control flow
PunithaSabareeswari 17-May-12 4:59am    
It won't repeating....

1 solution

When your control gets the focus, you display the message box. Which takes focus away from your control, and displays the message.,
You click ok, the box closes, and focus goes back to your control.
Which displays the message box. Which takes focus away from ...


And repeat.

Best solution? Don't do it there, or don't report via a message box. Use a label, or similar to report the problem instead.
 
Share this answer
 
Comments
Manoj K Bhoir 17-May-12 4:44am    
My 5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900