If (MessageBox.Show("Do you want to delete data before closing this form", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question)) = Windows.Forms.DialogResult.Yes Then
Dim connectionstring As String = "Driver=MySQL ODBC 3.51 Driver;Server=localhost;port=3306;uid=root;pwd=admin;Database=elcott;"
Dim conn As New OdbcConnection(connectionstring)
conn.Open()
Dim strsql As String
strsql = "Delete from userpass where username ='" & txUsername.Text & "'"
Dim sqlcmd As New OdbcCommand
sqlcmd.CommandText = strsql
sqlcmd.Connection = conn
sqlcmd.ExecuteNonQuery()
DataGridView1.Show()
MessageBox.Show("Information Successfully Deleted.")
txUsername.Text = ""
txPassword.Text = ""
txLastName.Text = ""
txFirstName.Text = ""
txMI.Text = ""
conn.Close()
ElseIf MsgBoxResult.No Then
MessageBox.Show("You did not Deleted your Information!!!")
txUsername.Text = ""
txPassword.Text = ""
txLastName.Text = ""
txFirstName.Text = ""
txMI.Text = ""
End If