Crystalyzer
Technical User
- Mar 28, 2003
- 218
I have a form with a textbox and a button. The form is NOT modal. I have the following code:
AND
My problem is that when I click on button1 I want the form to close without the textbox1 lostfocus event occurring. Is there a way to do this?
Any advice appreciated. Thanks.
Thanks and best regards,
-Lloyd
Code:
Private Sub textbox1_LostFocus(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles textbox1.LostFocus
If Not textbox1.Text = "" Then
LookupCompany()
Else
MessageBox.Show("Please enter a company", "Input Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
textbox1.Focus()
End If
End Sub
AND
Code:
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
ActiveForm.Dispose()
End Sub
My problem is that when I click on button1 I want the form to close without the textbox1 lostfocus event occurring. Is there a way to do this?
Any advice appreciated. Thanks.
Thanks and best regards,
-Lloyd