Home > DeveloperSection > Forums > How to insert,update,delete,next previous button in a single form vb.net winform.
aditya kumar Patel

Total Post:250

Points:1782
Posted on    January-01-2016 1:48 PM

 VB.Net VB.Net  Winforms 
Ratings:


 1 Reply(s)
 381  View(s)
Rate this:
I want to use insert,update,delete,next previous  button in a single form vb.net winform. how will do this please helpme.


aditya kumar Patel

Total Post:250

Points:1782
Posted on    January-01-2016 1:56 PM

i am using Multiple action in a single form such as add,edit,delete,save,first,next,previous,last,exit,cancel,and textbox value change ,combobox value change .following code below ->
Public Class frmledger
    Dim obj As New ledgerBAL
    Dim objBAL As New ledgerDAL
    'enter key tab handler Event
    Private Sub frmledger_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        If e.KeyCode = Keys.Enter Then
            SendKeys.Send("{TAB}")
      ElseIf e.Control Then
            If e.KeyCode = Keys.A Then
                btnadd.PerformClick()
            ElseIf e.KeyCode = Keys.C Then
                btncancel.PerformClick()
            ElseIf e.KeyCode = Keys.E Then
                btnedit.PerformClick()
            ElseIf e.KeyCode = Keys.S Then
                btnupdate.PerformClick()
            ElseIf e.KeyCode = Keys.D Then
                btndelete.PerformClick()
            ElseIf e.KeyCode = Keys.F Then
                btnfrist.PerformClick()
            ElseIf e.KeyCode = Keys.N Then
                btnnext.PerformClick()
            ElseIf e.KeyCode = Keys.P Then
                btnprevious.PerformClick()
            ElseIf e.KeyCode = Keys.L Then
                btnlast.PerformClick()
            ElseIf e.KeyCode = Keys.X Then
                btnclose.PerformClick()
            End If
        ElseIf e.KeyCode = Keys.Escape Then
           
            Dim result = MessageBox.Show(" Are you sure close This. ", "Are you sure?", MessageBoxButtons.OKCancel)
            If result = DialogResult.OK Then
                frmledger_list.Listview_Data()
                Me.Close()
            End If
        End If
    End Sub
    Private Sub frmledger_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        fill_Column()
        fill_accounttype(cboactype)
        fill_Cform(cboform)
        fill_TDS(cbotds)
        objBAL.Get_Data_Table()
        Last()
        txtledid.Focus()
    End Sub
    Public Sub fill_Column()
        Dim cbotype, cbobroker As New DataGridViewComboBoxColumn

        With cbotype
            .Name = "billtype"
            .HeaderText = "Bill Type"
            .Width = 200
        End With
        fillGrid_BillType(cbotype)
        With cbobroker
            .Name = "cbobroker"
            .HeaderText = "Broker"
            .Width = 250
        End With
        With dvggrid
            .Columns.Add(cbotype)
            .Columns.Add("billno", "Bill No")
            .Columns.Add("billdate", "Bill Date")
            .Columns.Add("billamnt", "Bill Amount")
            .Columns("billamnt").Width = 150
            .Columns.Add("billrecamnt", "Paid Amount")
            .Columns.Add("billbal", "Bill Balance")
            .Columns.Add(cbobroker)
        End With
    End Sub 
    Private Sub dvggrid_EditingControlShowing(sender As System.Object, e As System.Windows.Forms.DataGridViewEditingControlShowingEventArgs) Handles dvggrid.EditingControlShowing
        AddHandler e.Control.KeyPress, AddressOf dvggrid_KeyPress
        Dim cb As ComboBox
        If TypeOf e.Control Is ComboBox Then
            cb = e.Control
            'set the dropdown style of a combobox
            cb.DropDownStyle = ComboBoxStyle.DropDown
            'set the propety of a combobox to autocomplete mode.
            cb.AutoCompleteMode = AutoCompleteMode.SuggestAppend
            cb.AutoCompleteSource = AutoCompleteSource.ListItems

        End If
    End Sub 
    Private Sub dvggrid_CellEnter(sender As System.Object, e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dvggrid.CellEnter
        ''# Code to Dropdown DataGridViewComboBox in single click
        ''Header Cell clicked -> ignore it.
        If (e.RowIndex = -1) Then
            Return
        End If
        dvggrid.BeginEdit(True)
        If TypeOf dvggrid.EditingControl Is DataGridViewComboBoxEditingControl Then
            Dim control As DataGridViewComboBoxEditingControl = dvggrid.EditingControl
            If Not IsNothing(control) Then
                control.DroppedDown = True
            End If
        End If
        '#End of Code to Dropdown DataGridViewComboBox 
    End Sub
    Private Sub dvggrid_KeyPress(sender As System.Object, e As System.Windows.Forms.KeyPressEventArgs) Handles dvggrid.KeyPress
        If dvggrid.CurrentCell.ColumnIndex = 1 Or _
            dvggrid.CurrentCell.ColumnIndex = 2 Or _
            dvggrid.CurrentCell.ColumnIndex = 3 Then
            AllowOnlyNumeric(e, ".")
        End If
    End Sub
    Public Sub fill_filterdata()
        obj.led_id = txtledid.Text
        obj.Get_Data(obj)
        txtledid.Text = obj.led_id
        txtledname.Text = obj.led_Name
        txtadd1.Text = obj.Add1
        txtadd2.Text = obj.Add2
        txtadd3.Text = obj.Add3
        txtbadd1.Text = obj.Badd1
        txtbadd2.Text = obj.Badd2
        txtbadd3.Text = obj.Badd3
        txtmobile1.Text = obj.Mobile1
        txtmobile2.Text = obj.Mobile2
        txtphone1.Text = obj.phone1
        txtphone2.Text = obj.phone2
        txtfax.Text = obj.fax
        txtwebsite.Text = obj.Website
        txtemail.Text = obj.Email
        txtvattin.Text = obj.vat
        txtcsttinno.Text = obj.Csttax
        txtpanno.Text = obj.Pan_no
        txttanno.Text = obj.tanno
        txtservicetax.Text = obj.ser_tax
        cboform.SelectedValue = obj.form
        cboactype.SelectedValue = obj.ac_type
        txtbroker.Text = obj.br_name
        txtbroker_code.Text = obj.br_cd
        txtac_groupname.Text = obj.ac_name
        cbotds.SelectedValue = obj.tds
        txtconpersion.Text = obj.con_persion
        txtdesignation.Text = obj.Designation
        txtac_groupcode.Text = obj.ac_cd
        If obj.Page = 1 Then
            btnprevious.Enabled = False
            btnfrist.Enabled = False
            btnnext.Enabled = False
            btnlast.Enabled = False
        ElseIf obj.Page = Convert.ToInt32(lblrecordno.Text) Then
            btnprevious.Enabled = True
            btnfrist.Enabled = True
            btnnext.Enabled = False
            btnlast.Enabled = False
        Else
            btnprevious.Enabled = True
            btnfrist.Enabled = True
            btnnext.Enabled = True
            btnlast.Enabled = True
        End If
        
    End Sub
    Public Sub Nexts()
        obj.Page = obj.Page + 1
        obj.led_id = ""
        obj.Get_Data(obj)
        txtledid.Text = obj.led_id
        txtledname.Text = obj.led_Name
        txtadd1.Text = obj.Add1
        txtadd2.Text = obj.Add2
        txtadd3.Text = obj.Add3
        txtbadd1.Text = obj.Badd1
        txtbadd2.Text = obj.Badd2
        txtbadd3.Text = obj.Badd3
        txtmobile1.Text = obj.Mobile1
        txtmobile2.Text = obj.Mobile2
        txtphone1.Text = obj.phone1
        txtphone2.Text = obj.phone2
        txtfax.Text = obj.fax
        txtwebsite.Text = obj.Website
        txtemail.Text = obj.Email
        txtvattin.Text = obj.vat
        txtcsttinno.Text = obj.Csttax
        txtpanno.Text = obj.Pan_no
        txttanno.Text = obj.tanno
        txtservicetax.Text = obj.ser_tax
        cboform.SelectedValue = obj.form
        cboactype.SelectedValue = obj.ac_type
        txtbroker.Text = obj.br_name
        txtbroker_code.Text = obj.br_cd
        txtac_groupname.Text = obj.ac_name
        cbotds.SelectedValue = obj.tds
        txtconpersion.Text = obj.con_persion
        txtdesignation.Text = obj.Designation
        txtac_groupcode.Text = obj.ac_cd
        If obj.Page = 1 Then
            btnprevious.Enabled = False
            btnfrist.Enabled = False
            btnnext.Enabled = True
            btnlast.Enabled = True
            btnupdate.Enabled = False
            btncancel.Enabled = False
        ElseIf obj.Page = lblrecordno.Text Then
            btnprevious.Enabled = True
            btnfrist.Enabled = True
            btnnext.Enabled = False
            btnlast.Enabled = False
            btnupdate.Enabled = False
            btncancel.Enabled = False
        ElseIf obj.page > 1 Then
            btnprevious.Enabled = True
            btnfrist.Enabled = True
            btnnext.Enabled = True
            btnlast.Enabled = True
            btnupdate.Enabled = False
            btncancel.Enabled = False
        End If

        
    End Sub
    Public Sub Back()
        obj.Page = obj.Page - 1
        obj.led_id = ""
        obj.Get_Data(obj)
        txtledid.Text = obj.led_id
        txtledname.Text = obj.led_Name
        txtadd1.Text = obj.Add1
        txtadd2.Text = obj.Add2
        txtadd3.Text = obj.Add3
        txtbadd1.Text = obj.Badd1
        txtbadd2.Text = obj.Badd2
        txtbadd3.Text = obj.Badd3
        txtmobile1.Text = obj.Mobile1
        txtmobile2.Text = obj.Mobile2
        txtphone1.Text = obj.phone1
        txtphone2.Text = obj.phone2
        txtfax.Text = obj.fax
        txtwebsite.Text = obj.Website
        txtemail.Text = obj.Email
        txtvattin.Text = obj.vat
        txtcsttinno.Text = obj.Csttax
        txtpanno.Text = obj.Pan_no
        txttanno.Text = obj.tanno
        txtservicetax.Text = obj.ser_tax
        cboform.SelectedValue = obj.form
        cboactype.SelectedValue = obj.ac_type
        txtbroker.Text = obj.br_name
        txtbroker_code.Text = obj.br_cd
        txtac_groupname.Text = obj.ac_name
        cbotds.SelectedValue = obj.tds
        txtconpersion.Text = obj.con_persion
        txtdesignation.Text = obj.Designation
        txtac_groupcode.Text = obj.ac_cd
        If obj.Page = 1 Then
            btnprevious.Enabled = False
            btnfrist.Enabled = False
            btnnext.Enabled = True
            btnlast.Enabled = True
            btnupdate.Enabled = False
            btncancel.Enabled = False

        ElseIf obj.Page > 1 Then
            btnprevious.Enabled = True
            btnfrist.Enabled = True
            btnnext.Enabled = True
            btnlast.Enabled = True
            btnupdate.Enabled = False
            btncancel.Enabled = False
        End If
        
    End Sub
    Public Sub first()
        obj.Page = 1
        obj.led_id = ""
        obj.Get_Data(obj)
        txtledid.Text = obj.led_id
        txtledname.Text = obj.led_Name
        txtadd1.Text = obj.Add1
        txtadd2.Text = obj.Add2
        txtadd3.Text = obj.Add3
        txtbadd1.Text = obj.Badd1
        txtbadd2.Text = obj.Badd2
        txtbadd3.Text = obj.Badd3
        txtmobile1.Text = obj.Mobile1
        txtmobile2.Text = obj.Mobile2
        txtphone1.Text = obj.phone1
        txtphone2.Text = obj.phone2
        txtfax.Text = obj.fax
        txtwebsite.Text = obj.Website
        txtemail.Text = obj.Email
        txtvattin.Text = obj.vat
        txtcsttinno.Text = obj.Csttax
        txtpanno.Text = obj.Pan_no
        txttanno.Text = obj.tanno
        txtservicetax.Text = obj.ser_tax
        cboform.SelectedValue = obj.form
        cboactype.SelectedValue = obj.ac_type
        txtbroker.Text = obj.br_name
        txtbroker_code.Text = obj.br_cd
        txtac_groupname.Text = obj.ac_name
        cbotds.SelectedValue = obj.tds
        txtconpersion.Text = obj.con_persion
        txtdesignation.Text = obj.Designation
        txtac_groupcode.Text = obj.ac_cd
        If obj.Page = 1 Then
            btnprevious.Enabled = False
            btnfrist.Enabled = False
            btnnext.Enabled = True
            btnlast.Enabled = True
            btnupdate.Enabled = False
            btncancel.Enabled = False
        End If 
    End Sub
    Public Sub Last()
        obj.Page = 0
        obj.led_id = ""
        obj.Get_Data(obj)
        txtledid.Text = obj.led_id
        txtledname.Text = obj.led_Name
        txtadd1.Text = obj.Add1
        txtadd2.Text = obj.Add2
        txtadd3.Text = obj.Add3
        txtbadd1.Text = obj.Badd1
        txtbadd2.Text = obj.Badd2
        txtbadd3.Text = obj.Badd3
        txtmobile1.Text = obj.Mobile1
        txtmobile2.Text = obj.Mobile2
        txtphone1.Text = obj.phone1
        txtphone2.Text = obj.phone2
        txtfax.Text = obj.fax
        txtwebsite.Text = obj.Website
        txtemail.Text = obj.Email
        txtvattin.Text = obj.vat
        txtcsttinno.Text = obj.Csttax
        txtpanno.Text = obj.Pan_no
        txttanno.Text = obj.tanno
        txtservicetax.Text = obj.ser_tax
        cboform.SelectedValue = obj.form
        cboactype.SelectedValue = obj.ac_type
        txtbroker.Text = obj.br_name
        txtbroker_code.Text = obj.br_cd
        txtac_groupname.Text = obj.ac_name
        cbotds.SelectedValue = obj.tds
        txtconpersion.Text = obj.con_persion
        txtdesignation.Text = obj.Designation
        txtac_groupcode.Text = obj.ac_cd
        lblrecordno.Text = obj.Page
        Desable()
        If obj.Page > 1 Then
            btnprevious.Enabled = True
            btnfrist.Enabled = True
            btnlast.Enabled = False
            btnnext.Enabled = False
            btnupdate.Enabled = False
            btncancel.Enabled = False
        ElseIf obj.Page = 1 Then
            btnprevious.Enabled = False
            btnfrist.Enabled = False
            btnnext.Enabled = False
            btnlast.Enabled = False

            btnupdate.Enabled = False
            btncancel.Enabled = False
        End If
        If obj.msg = "Yes" Then
            btndelete.Enabled = True
            btnedit.Enabled = True

        Else
            btndelete.Enabled = False
            btnedit.Enabled = False
            btnprevious.Enabled = False
            btnfrist.Enabled = False
            btnlast.Enabled = False
            btnnext.Enabled = False
            btnupdate.Enabled = False
            btncancel.Enabled = False
            btnadd.Enabled = True
        End If
         
    End Sub
    Public Sub insert_data()
        If txtledname.Text = "" Then
            MsgBox("Party Name Can Not be blank.")
            txtledname.Focus()
            Exit Sub
        Else
            If cbotds.SelectedValue = Nothing Then
                obj.tds = 0
            Else
                obj.tds = IIf(IsDBNull(cbotds.SelectedValue), 0, cbotds.SelectedValue)
            End If
            If cboform.SelectedValue = Nothing Then
                obj.form = 0
            Else
                obj.form = IIf(IsDBNull(cboform.SelectedValue), 0, cboform.SelectedValue)
            End If
            If cboactype.SelectedValue = Nothing Then
                obj.ac_type = 0
            Else
                obj.ac_type = IIf(IsDBNull(cboactype.SelectedValue), 0, cboactype.SelectedValue)
            End If
            obj.led_id = txtledid.Text
            obj.led_Name = IIf(IsDBNull(txtledname.Text), "", txtledname.Text)
            obj.Add1 = IIf(IsDBNull(txtadd1.Text), "", txtadd1.Text)
            obj.Add2 = IIf(IsDBNull(txtadd2.Text), "", txtadd2.Text)
            obj.Add3 = IIf(IsDBNull(txtadd3.Text), "", txtadd3.Text)
            obj.Badd1 = IIf(IsDBNull(txtbadd1.Text), "", txtbadd1.Text)
            obj.Badd2 = IIf(IsDBNull(txtbadd2.Text), "", txtbadd2.Text)
            obj.Badd3 = IIf(IsDBNull(txtbadd3.Text), "", txtbadd3.Text)
            obj.phone1 = IIf(IsDBNull(txtmobile1.Text), "", txtmobile1.Text)
            obj.phone2 = IIf(IsDBNull(txtmobile2.Text), "", txtmobile2.Text)
            obj.Mobile1 = IIf(IsDBNull(txtmobile1.Text), "", txtmobile1.Text)
            obj.Mobile2 = IIf(IsDBNull(txtmobile2.Text), "", txtmobile2.Text)
            obj.fax = IIf(IsDBNull(txtfax.Text), "", txtfax.Text)
            obj.Website = IIf(IsDBNull(txtwebsite.Text), "", txtwebsite.Text)
            obj.Email = IIf(IsDBNull(txtemail.Text), "", txtemail.Text)
            obj.vat = IIf(IsDBNull(txtvattin.Text), "", txtvattin.Text)
            obj.Csttax = IIf(IsDBNull(txtcsttinno.Text), "", txtcsttinno.Text)
            obj.Pan_no = IIf(IsDBNull(txtpanno.Text), "", txtpanno.Text)
            obj.tanno = IIf(IsDBNull(txttanno.Text), "", txttanno.Text)
            obj.ser_tax = IIf(IsDBNull(txtservicetax.Text), "", txtservicetax.Text)
            obj.br_cd = IIf(IsDBNull(txtbroker_code.Text), "", txtbroker_code.Text)
            obj.ac_cd = IIf(IsDBNull(txtac_groupcode.Text), "", txtac_groupcode.Text)
            obj.con_persion = IIf(IsDBNull(txtconpersion.Text), "", txtconpersion.Text)
            obj.Designation = IIf(IsDBNull(txtdesignation.Text), "", txtdesignation.Text)
            objBAL.insert_LEDGER(obj)
            cleare()
            Last()
            Desable()
            btnadd.Enabled = True
            btncancel.Enabled = False
            btnedit.Enabled = True
            btnclose.Enabled = True
            btndelete.Enabled = True
            btnupdate.Enabled = False
        End If
    End Sub
    Public Sub cleare()
        txtledid.Text = ""
        txtledname.Text = ""
        txtadd1.Text = ""
        txtadd2.Text = ""
        txtadd3.Text = ""
        txtbadd1.Text = ""
        txtbadd2.Text = ""
        txtbadd3.Text = ""
        txtmobile1.Text = ""
        txtmobile2.Text = ""
        txtphone1.Text = ""
        txtphone2.Text = ""
        txtconpersion.Text = ""
        txtdesignation.Text = ""
        txtfax.Text = ""
        txtwebsite.Text = ""
        txtemail.Text = ""
        txtvattin.Text = ""
        txtcsttinno.Text = ""
        txtpanno.Text = ""
        txtservicetax.Text = ""
        cboactype.SelectedValue = "0"
        txtbroker_code.Text = ""
        txtac_groupname.Text = ""
        txtac_groupcode.Text = ""
        txtbroker.Text = ""
        cbotds.SelectedValue = "0"
        cboform.SelectedValue = "0"
        txttanno.Text = ""
        txtledname.Focus()
    End Sub
    Public Sub Desable()
        txtbroker.Enabled = False
        txtledname.Enabled = False
        txtadd1.Enabled = False
        txtadd2.Enabled = False
        txtadd3.Enabled = False
        txtbadd1.Enabled = False
        txtbadd2.Enabled = False
        txtbadd3.Enabled = False
        txtmobile1.Enabled = False
        txtmobile2.Enabled = False
        txtphone1.Enabled = False
        txtphone2.Enabled = False
        txtfax.Enabled = False
        txtwebsite.Enabled = False
        txtemail.Enabled = False
        txtvattin.Enabled = False
        txtcsttinno.Enabled = False
        txtpanno.Enabled = False
        txtservicetax.Enabled = False
        cboactype.Enabled = False
        txtac_groupname.Enabled = False
        cbotds.Enabled = False
        cboform.Enabled = False
        txtconpersion.Enabled = False
        txtdesignation.Enabled = False
        txttanno.Enabled = False
        txtledid.Focus()
    End Sub
    Public Sub Enable()
        txttanno.Enabled = True
        txtconpersion.Enabled = True
        txtdesignation.Enabled = True
        txtledname.Enabled = True
        txtadd1.Enabled = True
        txtadd2.Enabled = True
        txtadd3.Enabled = True
        txtbadd1.Enabled = True
        txtbadd2.Enabled = True
        txtbadd3.Enabled = True
        txtmobile1.Enabled = True
        txtmobile2.Enabled = True
        txtphone1.Enabled = True
        txtphone2.Enabled = True
        txtfax.Enabled = True
        txtwebsite.Enabled = True
        txtemail.Enabled = True
        txtvattin.Enabled = True
        txtcsttinno.Enabled = True
        txtpanno.Enabled = True
        txtservicetax.Enabled = True
        cboactype.Enabled = True
        txtac_groupname.Enabled = True
        cbotds.Enabled = True
        cboform.Enabled = True
        txtbroker.Enabled = True
    End Sub

    Private Sub cboform_GotFocus(sender As Object, e As System.EventArgs) Handles cboform.GotFocus
        cboform.DroppedDown = True
    End Sub

    Private Sub cbotds_GotFocus(sender As Object, e As System.EventArgs) Handles cbotds.GotFocus
        cbotds.DroppedDown = True
    End Sub

    Private Sub cboactype_GotFocus(sender As Object, e As System.EventArgs) Handles cboactype.GotFocus
        cboactype.DroppedDown = True
    End Sub
    Private Sub txtbroker_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles txtbroker.KeyDown
        If (e.KeyCode = Keys.F1) Then
            formname = Me.Name
            frmbroker_list.ShowDialog()
        End If
    End Sub

    Private Sub cboactype_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles cboactype.SelectedIndexChanged
        If (cboactype.Text = "CUSTOMER" Or cboactype.Text = "SUPPLIER") Then
            txtbroker.Enabled = True
        Else
            txtbroker.Enabled = False
        End If
    End Sub
    Private Sub txtledname_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles txtledname.KeyDown
        If (e.KeyCode = Keys.F1) Then
            formname = Me.Name
            sfilter = ""
            frmledger_list.ShowDialog()
        End If
    End Sub
    Private Sub btnadd_Click(sender As System.Object, e As System.EventArgs) Handles btnadd.Click
        Enable()
        cleare()
        txtledid.Text = Get_ID("ledger_master", "lc_cd", "LE/", False)
        btnadd.Enabled = False
        btncancel.Enabled = True
        btnedit.Enabled = False
        btnclose.Enabled = True
        btndelete.Enabled = False
        btnfrist.Enabled = False
        btnlast.Enabled = False
        btnnext.Enabled = False
        btnprevious.Enabled = False
        btnupdate.Enabled = True

    End Sub
    Private Sub btnedit_Click(sender As System.Object, e As System.EventArgs) Handles btnedit.Click
        Enable()
        btnadd.Enabled = False
        btncancel.Enabled = True
        btnedit.Enabled = False
        btnclose.Enabled = True
        btndelete.Enabled = True
        btnupdate.Enabled = True
        btnprevious.Enabled = False
        btnfrist.Enabled = False
        btnlast.Enabled = False
        btnnext.Enabled = False
    End Sub
    Private Sub btnupdate_Click(sender As System.Object, e As System.EventArgs) Handles btnupdate.Click
        insert_data()
    End Sub
    Private Sub btncancel_Click(sender As System.Object, e As System.EventArgs) Handles btncancel.Click
        btnadd.Enabled = True
        btncancel.Enabled = False
        btnedit.Enabled = True
        btnclose.Enabled = True
        btndelete.Enabled = True
        btnupdate.Enabled = False
        cleare()
        Desable()
        Last()
    End Sub
    Private Sub btndelete_Click(sender As System.Object, e As System.EventArgs) Handles btndelete.Click
        Dim result = MessageBox.Show(" Are you sure you want to Delete", "Are you sure?", MessageBoxButtons.OKCancel)
        If result = DialogResult.OK Then
            delrecsql("ledger_master", "lc_cd", txtledid.Text, False)
            cleare()
            Desable()
            Last()
        End If
    End Sub
    Private Sub btnfrist_Click(sender As System.Object, e As System.EventArgs) Handles btnfrist.Click
        Desable()
        first()
    End Sub
    Private Sub btnnext_Click(sender As System.Object, e As System.EventArgs) Handles btnnext.Click
        Desable()
        Nexts()
    End Sub
    Private Sub btnprevious_Click(sender As System.Object, e As System.EventArgs) Handles btnprevious.Click
        Desable()
        Back()
    End Sub

    Private Sub btnlast_Click(sender As System.Object, e As System.EventArgs) Handles btnlast.Click
        Desable()
        Last()
    End Sub
    Private Sub btnclose_Click(sender As System.Object, e As System.EventArgs) Handles btnclose.Click
        frmledger_list.Listview_Data()
        Me.Close()
    End Sub
    Private Sub txtledid_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles txtledid.KeyDown
        If (e.KeyCode = Keys.F1) Then
            formname = Me.Name
            sfilter = ""
            frmledger_list.ShowDialog()
        End If
    End Sub
    Private Sub TextBox_Leave(ByVal sender As Object, ByVal e As System.EventArgs) _
     Handles txtledname.Leave, txtac_groupname.Leave, txtbroker.Leave
        Dim tb As TextBox = DirectCast(sender, TextBox)
        With tb
            Select Case tb.Name
                Case "txtledname"
                    If CheckName("ledger_master", "lc_cd", txtledid.Text) = 1 Then
                    ElseIf CheckName("ledger_master", "replace(lc_name,' ','')", Replace(txtledname.Text, " ", "")) = 1 Then
                        MsgBox("This Name Already Exists !!")
                        Exit Sub
                    End If
                    If .Text = "" Then
                        MsgBox("This field is Required !!")
                    End If
                Case "txtbroker"
                    If .Text = "" Then
                        MsgBox("This field Select From Master Press F1  !!")
                    End If
                Case "txtac_groupname"
                    If .Text = "" Then
                        MsgBox("This field Select From Master Press F1  !!")
                    End If
            End Select
        End With
    End Sub

    Private Sub ComboBox_Leave(ByVal sender As Object, ByVal e As System.EventArgs) _
    Handles cboactype.Leave
        Dim tb As ComboBox = DirectCast(sender, ComboBox)
        With tb
            Select Case tb.Name
                Case "cboactype"
                    If .Text = "" Then
                        MsgBox("Please Select a Account Type !!")
                    End If
            End Select
        End With
    End Sub
    Private Sub txtac_groupname_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles txtac_groupname.KeyDown
        If (e.KeyCode = Keys.F1) Then
            formname = Me.Name
            accountgroup_list.ShowDialog()
        End If
    End Sub
End Class


Don't want to miss updates? Please click the below button!

Follow MindStick