views:

36

answers:

0

Hi.

I have a datagridview with two combo boxes, all the cmb are bound to bindingsources

The first cmb has the customers where the customers has projects

The second cmb has the projects of the customers

When I select a customer from the first cmb I do this (between others)

If Me.StaffExtraPaymentsDataGridView.CurrentRow.Cells(1).IsInEditMode Then

  Dim CustID As Integer = combo.SelectedValue

  Me.ProjectsBindingSource.Filter = ("CustomerID=" & CustID)

  End If

the second cmb if filtering just fine..

the problem is when I select a different customer..

then all the comboboxes that the project is not from the last customer selection lost there values until I close the form and open it again.

The values in the DB are not lost but in the datagridview they disappear.. I have try all the tricks to refresh the datagridview with no result…

tricks i try

'Me.ProjectsBindingSource.ResetBindings(False)

 'Me.BindingContext(Me.StaffExtraPaymentsDataGridView.DataSource).EndCurrentEdit()

 'Me.StaffExtraPaymentsDataGridView.Refresh()

'Me.StaffExtraPaymentsDataGridView.Parent.Refresh()

 'Me.ProjectsBindingSource.EndEdit()

'Me.StaffExtraPaymentsBS.EndEdit()

 'Me.StaffExtraPaymentsDataGridView.DataSource = Nothing

'Me.StaffExtraPaymentsDataGridView.DataSource = Me.StaffExtraPaymentsBS

'Me.StaffExtraPaymentsTA.Fill(Me.StaffDataSet.StaffExtraPayments)

'Me.StaffExtraPaymentsDataGridView.Refresh()

and some others...

1) There is any way to refresh the datagridview?

2) There is other way to filter the bindingsource so the projects combo bring only the projects that belong to the selected customer?

Thank you for reading