View Single Post
Old Dec 3rd, 2006, 6:25 AM   #1
Robocop
Programmer
 
Join Date: Sep 2004
Posts: 44
Rep Power: 0 Robocop is on a distinguished road
VB If Statement Help

I just want to make these statements so that when the if is true, the message box is shown and the form is not closed. If the required fields are blank, then the form should not close, but it is closing after you click the message box. Can anybody help me with this?

Quote:
Private Sub Form1_Closed(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Closed
If Me.edit_type.Text = "" Or Me.editname.Text = "" Then
'MessageBox.Show("Please fill the required fields.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
'Update the Dataset
Me.UpdateDataSet()
End If
End Sub
Robocop is offline   Reply With Quote