I have done data validation.So now when proper data is not entered it will show an message box showing error but also it shows the following message box where i want to block or hide the message box from popping up. Here is my code below. Please show me my error and give me a solution. Thanks
Dim digit As Integer
Dim text As String
Try
digit = CInt(txtsid.Text) & CInt(txtsph.Text)
Text = CStr(txtsfn.Text) & CStr(txtsln.Text) & CStr(txtsem.Text) & CStr(txtint.Text)
Catch ex As Exception
MessageBox.Show("Please Type In A Proper Information")
End Try
Dim result As Integer = MessageBox.Show("Are you sure you want to proceed?", "Proceed", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
If result = DialogResult.Yes Then
cmdInsert.CommandText = "Insert into student Values(" + txtsid.Text + ",'" + txtint.Text + "','" + txtsfn.Text + "','" + txtsln.Text + "', '" + cmbgen.Text + "', " + txtsph.Text + ", '" + txtsem.Text + "');"
cmdInsert.CommandType = CommandType.Text
cmdInsert.Connection = cnnOLEDB
cmdInsert.ExecuteNonQuery()
UserHomepage.Show()
Me.Hide()
ElseIf result = DialogResult.No Then
Me.Show()
UserHomepage.Hide()
End If
End Sub