G
Guest
I have a Windows form with a number of Bound Controls. When I want to add a new record I clear all the combo boxes and text boxes by setting the text properties to "". To add a new record to the dataset I use
Dim drNew As System.Data.DataRo
drNew = Me.DsEstablishMaint1.Establishments.NewRo
With drNe
.Item("Code") = txtEstCode.Tex
.Item("Name") = txtName.Tex
.Item("Street") = txtAddress1.Tex
e.t.c
End Wit
DsEstablishMaint1.Establishments.AddEstablishmentsRow(drNew
The problem I have got is that I have a bound Combobox at the top of my form to select a record based on name. After adding a new record the name on the record I have just entered appears twice: once in the correct alphabetical position and once at the end of the list. If I try and select any name in the list my program crashes with "Duplicate values are not allowed on name" which is my primary key. I have tried experimenting with Currency Manager's AddNew() method but this created further problems. So is there a way to prevent the duplicate values appearing in my combo box and why should this happen anyway?
Dim drNew As System.Data.DataRo
drNew = Me.DsEstablishMaint1.Establishments.NewRo
With drNe
.Item("Code") = txtEstCode.Tex
.Item("Name") = txtName.Tex
.Item("Street") = txtAddress1.Tex
e.t.c
End Wit
DsEstablishMaint1.Establishments.AddEstablishmentsRow(drNew
The problem I have got is that I have a bound Combobox at the top of my form to select a record based on name. After adding a new record the name on the record I have just entered appears twice: once in the correct alphabetical position and once at the end of the list. If I try and select any name in the list my program crashes with "Duplicate values are not allowed on name" which is my primary key. I have tried experimenting with Currency Manager's AddNew() method but this created further problems. So is there a way to prevent the duplicate values appearing in my combo box and why should this happen anyway?