Hi,
I have a strange problem that I can't seem to solve.
Using VB.net 2005
On a form I have a comboboxen that is populated thru datatables.
One combobox hold names of relations of the company
Valuemember is set to ID column (relatieID)
Displaymember is set to the relationname (RelatieNaam).
After selecting a relation a combobox holding contacts will be filled with the contacts of the selected relation.
There is no problem with this. All works fine.
But......
Now in de relation table there are relations with similair names but diffrent ID's.
Should be no problem but when a duplicated relation is selected it fills the contacts always with the same contacts.
Stepped thru code and I found out that the moment you leave the combobox its selectedvalue is changed but no code is run to do that. It goes into the LostFocus code before running that the selected value has been changed already
Is there someone familiar with this problem or knows a clean solution to it.
Thanks in advance.
Here is code that is used by combobox for selecting the relation
I have a strange problem that I can't seem to solve.
Using VB.net 2005
On a form I have a comboboxen that is populated thru datatables.
One combobox hold names of relations of the company
Valuemember is set to ID column (relatieID)
Displaymember is set to the relationname (RelatieNaam).
After selecting a relation a combobox holding contacts will be filled with the contacts of the selected relation.
There is no problem with this. All works fine.
But......
Now in de relation table there are relations with similair names but diffrent ID's.
Should be no problem but when a duplicated relation is selected it fills the contacts always with the same contacts.
Stepped thru code and I found out that the moment you leave the combobox its selectedvalue is changed but no code is run to do that. It goes into the LostFocus code before running that the selected value has been changed already
Is there someone familiar with this problem or knows a clean solution to it.
Thanks in advance.
Here is code that is used by combobox for selecting the relation
Code:
Private Sub RelatieGewijzigd(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles comboRelatie.SelectionChangeCommitted, comboRelatie.SelectedValueChanged
'Controleren of formulier geladen wordt
If isLoading = False And isVernieuwen = False Then
'Controleren dat keuze niet leeg is
If IsNothing(comboRelatie.SelectedValue) Then
'Instellen dat er geen keuze is gemaakt
varRelatie = 0
Else
'Keuze overnemen
varRelatie = comboRelatie.SelectedValue
End If
'Keuzelijst contactpersonen vernieuwen
OphalenGegevens(WelkeGegevens.Contactpersonen)
'Keuze contactpersoon wissen
comboContactpersoon.SelectedValue = 0
'Instellen dat er wijzigingen zijn geweest
isGewijzigd = True
End If
End Sub
Private Sub comboRelatie_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles comboRelatie.LostFocus
'Controleren of de selectie
If IsNothing(comboRelatie.SelectedValue) Then
If Not comboRelatie.Text = String.Empty Then
'Gegevens controleren
Relatie.Check(comboRelatie, varData, "Relaties")
'Contact personen vernieuwen
OphalenGegevens(WelkeGegevens.Contactpersonen)
End If
End If
End Sub