Private Sub cmdsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdsave.Click
If txtid.Text = "" Or txtname.Text = "" Or txtmn.Text = "" Or txtln.Text = "" Or cbogender.Text = "" Or cbosub.Text = "" Or cbopos.Text = "" Then
MsgBox("Complete All Fields Needed", MsgBoxStyle.Information, "")
txtid.Focus()
ElseIf IsNumeric(txtid.Text) = False Then
MsgBox("ID number should be numbers only")
ElseIf sb = True Then
mycmd.Connection = mycon
mycmd.CommandText = "insert into `tbluseradmin`(`ID`,`Name`,`MiddleName`,`LastName`,`Gender`,`Subject`,`Position`)values('" & txtid.Text & "','" & txtname.Text & "','" & txtmn.Text & "','" & txtln.Text & "','" & cbogender.Text & "','" & cbosub.Text & "','" & cbopos.Text & "')"
mycmd.ExecuteNonQuery()
mycon.Close()
My.Computer.FileSystem.CopyFile(ofd.FileName, Application.StartupPath & "\images\" & txtid.Text & ".jpg")
MsgBox("Record Save", MsgBoxStyle.Information, "")
Call connect()
Call display()
Call textboxlocked()
Call buttonunlock()
Call cmdlock()
Call cmd2unlock()
Else
mycmd.Connection = mycon
mycmd.CommandText = "update `tbluseradmin` set`ID`='" & txtid.Text & "',`Name`='" & txtname.Text & "',`MiddleName`='" & txtmn.Text & "',`LastName`='" & txtln.Text & "',`Gender`='" & cbogender.Text & "'where`ID`='" & idnum & "'"
mycmd.ExecuteNonQuery()
mycon.Close()
My.Computer.FileSystem.CopyFile(ofd.FileName, Application.StartupPath & "\images\" & txtid.Text & ".jpg")
MsgBox("Record Update", MsgBoxStyle.Information, "")
Call connect()
Call display()
Call textboxlocked()
Call buttonunlock()
Call cmdlock()
Call cmd2unlock()
End If
End Sub