Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 16039

VS 2015 WIndows form Add new record with code

$
0
0
I have a form that everything works on except adding records when called from another form. I am trying to add with the bindingsource.addnew. Which I like because it doesn't save until they hit the save button. This is what I have but I read it doesn't work. The bindingsource addnew only creates a detached record so this wont work.

Code:

        If Application.OpenForms().OfType(Of OperShiftLog).Any _
        Or Application.OpenForms().OfType(Of OperShiftLog1).Any Then
            Me.Laser_Status_InfoBindingSource.Filter = "Printer = '" & Pass_Printer & "'"
            If Pass_AddMod = "M" Then
                BindingNavigatorDeleteItem.Enabled = False
                BindingNavigatorAddNewItem.Enabled = False
                Me.Laser_Status_InfoBindingSource.Filter = "Shift_FKey = '" & Pass_Shift_Key & "' AND Printer = '" & Pass_Printer & "'"
            Else
                Add_New = True
                Me.Laser_Status_InfoBindingSource.AddNew()
                tbStatus_key.Text = Int32.MaxValue
                tbShift_FKey.Text = Pass_Shift_Key
                chkbSerReq.Checked = False
                tbSvcReq.Text = ""
                tbMeter.Text = 0
                cmbStatus.Text = "Up"
                dtpErr_time.Value = DateTime.Now
                cmbPrinter.SelectedValue = Pass_Printer
                cmbOperator.SelectedValue = Pass_Operator
                cmbStatus.Focus()
                'Save_Current()
            End If
            cmbSelPrinter.Visible = False
            '.visible = False
            chkbActiveSel.Visible = False
            'cmbSelPrinter.SelectedValue = Pass_Printer
            'cmbSelPrinter.Enabled = False
            'chkbActiveSel.Enabled = False
            cmbPrinter.Enabled = False
            cmbOperator.Enabled = False
            dgvLaser_Status_Info.Enabled = False
        Else
            Me.Laser_Status_InfoBindingSource.Filter = "Printer = '" & cmbSelPrinter.SelectedValue & "'"
            Me.Laser_Status_InfoBindingSource.Sort = "Err_Time"
            Me.Laser_Status_InfoBindingSource.MoveLast()

            chkbActiveSel.Checked = True
            fillSelPrinter()
        End If


Viewing all articles
Browse latest Browse all 16039

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>