Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vb.net #35

Open
KalidElAhmedi opened this issue Feb 6, 2018 · 0 comments
Open

vb.net #35

KalidElAhmedi opened this issue Feb 6, 2018 · 0 comments

Comments

@KalidElAhmedi
Copy link

Imports System.Data.OleDb
Public Class frm_class

Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
    Try

        If txtClassNumber.Text = "" Then
            MsgBox("Fadlan ku qor numberka classka ")
            txtClassNumber.Focus()
            Exit Sub
        End If
        If txtNumberofTables.Text = "" Then
            MsgBox("Fadlan ku qor Tirada miisaska")
            txtNumberofTables.Focus()
            Exit Sub
        End If

        If txtNumberofChairs.Text = "" Then
            MsgBox("Fadlan ku qor Tirada kuraasta")
            txtNumberofChairs.Focus()
            Exit Sub
        End If
        con = New OleDbConnection(cs)
        con.Open()
        Dim cb As String = "insert into [class]  VALUES (" & txtClassNumber.Text & ",'" & txtNumberofTables.Text & "','" & txtNumberofChairs.Text & "')"
        cmd = New OleDbCommand(cb)
        cmd.Connection = con
        cmd.ExecuteReader()
        MessageBox.Show("Saved Successfully", "Record", MessageBoxButtons.OK, MessageBoxIcon.Information)

        Reset()


    Catch ex As Exception
        MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Try

End Sub

Private Sub btnReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnReset.Click
    Reset()

End Sub
Sub Reset()

    txtClassNumber.Text = ""
    txtNumberofTables.Text = ""
    txtNumberofChairs.Text = ""
  
    txtClassNumber.Focus()
End Sub

Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click
    End

End Sub

End Class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant