1 Replies - 1486 Views - Last Post: 05 November 2013 - 08:57 AM Rate Topic: -----

#1 nilesh7136  Icon User is offline

  • D.I.C Head

Reputation: 10
  • View blog
  • Posts: 120
  • Joined: 03-January 13

Binding Source .AddNew Problem

Posted 19 October 2013 - 12:03 AM

Hello There,,

i have problem in .addnew property in BindingSource,
all are working fine, but when i try to insert new record in bindingsource, i used .AddNew at that time all the binded control are not refresh, its display old value,
this is the code

.AddNew Code
   Private Sub D_TripGridView_KeyDown(sender As Object, e As KeyEventArgs) Handles D_TripGridView.KeyDown
        If e.KeyCode = Keys.Insert Then
            Status_Parent = True
            GridPanel.IsOpen = False
           
            BS_Trip.AddNew()
            BS_Trip.Current!LoadDate = Date.Today
            TruckIDComboBox.Focus()
            BS_Trip.EndEdit()
        End If
    End Sub


Code Of Controls Binding
Function SetBindingSource()
        TruckIDComboBox.DataBindings.Add(New Windows.Forms.Binding("SelectedValue", BS_Trip, "TruckID"))
        LoadDateDateEdit.DataBindings.Add(New Windows.Forms.Binding("Value", BS_Trip, "LoadDate"))
        TransportIDComboBox.DataBindings.Add(New Windows.Forms.Binding("SelectedValue", BS_Trip, "TransportID"))
        MaterialIDComboBox.DataBindings.Add(New Windows.Forms.Binding("SelectedValue", BS_Trip, "MaterialID"))
        FromIDComboBox.DataBindings.Add(New Windows.Forms.Binding("SelectedValue", BS_Trip, "FromID"))
        ToIDComboBox.DataBindings.Add(New Windows.Forms.Binding("SelectedValue", BS_Trip, "ToID"))
        LoadWtTextEdit.DataBindings.Add(New Windows.Forms.Binding("Text", BS_Trip, "LoadWt"))
        UnloadWtTextEdit.DataBindings.Add(New Windows.Forms.Binding("Text", BS_Trip, "UnloadWt"))
        ShortageTextEdit.DataBindings.Add(New Windows.Forms.Binding("Text", BS_Trip, "Shortage"))
        RateTextEdit.DataBindings.Add(New Windows.Forms.Binding("Text", BS_Trip, "Rate"))
        TotalFrieightTextEdit.DataBindings.Add(New Windows.Forms.Binding("Text", BS_Trip, "TotalFreight"))
        TotalExpensesAmtTextEdit.DataBindings.Add(New Windows.Forms.Binding("Text", BS_Trip, "TotalExpensesAmt"))
        TotalAdditionAmtTextEdit.DataBindings.Add(New Windows.Forms.Binding("Text", BS_Trip, "TotalAdditionAmt"))
        SavingTextEdit.DataBindings.Add(New Windows.Forms.Binding("Text", BS_Trip, "Saving"))
        DriverIDComboBox.DataBindings.Add(New Windows.Forms.Binding("SelectedValue", BS_Trip, "DriverID"))
        EndingKMTextEdit.DataBindings.Add(New Windows.Forms.Binding("Text", BS_Trip, "TripEndingKM"))
        DescriptionTextEdit.DataBindings.Add(New Windows.Forms.Binding("Text", BS_Trip, "TripDescription"))

        D_TripAdditionDataGridView.DataSource = BS_Addition
        D_TripExpensesDataGridView.DataSource = BS_Expenses

        Return True
    End Function


help me to solve this problem

@Nilesh

Is This A Good Question/Topic? 0
  • +

Replies To: Binding Source .AddNew Problem

#2 Psyguy  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 69
  • View blog
  • Posts: 314
  • Joined: 12-January 11

Re: Binding Source .AddNew Problem

Posted 05 November 2013 - 08:57 AM

This could be the answer.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1