Public Class Adminpage
    Dim result As MsgBoxResult

    Public Sub shw()

    End Sub
    Private Sub Adminpage_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        clr()
    End Sub
    Public Sub clr()
        patientno.Text = ""
        lasttxt.Text = ""
        Firsttxt.Text = ""
        Middletxt.Text = ""
        ComboBox1.Text = ""
        gencbad.Text = "Select..."
        MaskedTextBox1.Text = "Select..."
        baltxt.Text = ""
    End Sub


    Public Sub edit_record()

        setCmd("SELECT * FROM admin WHERE No = '" & temp1 & "'")
        setOrs()
        patientno.Text = Ors.Fields("No").Value
        lasttxt.Text = Ors.Fields("Last").Value
        Firsttxt.Text = Ors.Fields("First").Value
        Middletxt.Text = Ors.Fields("Middle").Value
        ComboBox1.Text = Ors.Fields("Gender").Value
        gencbad.Text = Ors.Fields("Age").Value
        MaskedTextBox1.Text = Ors.Fields("Visit").Value
        baltxt.Text = Ors.Fields("Payment").Value
    End Sub

    Public Sub add_record()

        'If patientno.Text = ""  Or lasttxt.Text = "" Or Firsttxt.Text = "" Or  Middletxt.Text = ""Or ComboBox1.Text = "" Or gencbad.Text = "Select..." Or MaskedTextBox1.Text = "Select..."  Or baltxt.Text = "____-_______" Then
        '    MsgBox("Please complete the all information")
        '    empty()
        'Else

        result = MsgBox("Do you want to save the new this?", MsgBoxStyle.YesNo)

        If result = MsgBoxResult.Yes Then

            setCmd("INSERT INTO  admin(No,Last,First,Middle,Gender Age,Visit,Payment,Active) values('" & patientno.Text & "'," & lasttxt.Text & "', " & Firsttxt.Text & "','" & Middletxt.Text & "','" & ComboBox1.Text & "','" & gencbad.Text & "','" & MaskedTextBox1.Text & "','" & baltxt.Text & "','Y')")
            MsgBox("Record has been successfully addded.")

            clr()
            Refresh()


            Refresh()

            Me.Hide()
            Main.Enabled = True

            '  txtbox_filled()
        End If
        ' End If

    End Sub

    Private Sub DataGridView1_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)

    End Sub
    Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs)

    End Sub

    Private Sub main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        shw()
    End Sub

    Public Sub delete_record()



    End Sub

    Private Sub addbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles addbtn.Click

    End Sub

    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
        delete_record()

    End Sub

    Private Sub exitbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitbtn.Click
        Form1.Show()
    End Sub

    Private Sub editbtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles editbtn.Click

        lblActive.Text = "N"
        savebtn.Enabled = False
        editbtn.Enabled = True
    End Sub

    Private Sub savebtn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles savebtn.Click
        add_record()
    End Sub

End Class

Hello dangeroz- its fantastic that you put this code together and created a thread, but it would be more helpful if you provide additional information such as what questions, issues, or errors you are experiencing.

Without this additional information, we have no idea what it is you are asking or need help with.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.