Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combobox and DBNull

Status
Not open for further replies.

Durkin

Programmer
Nov 6, 2000
304
GB
Hi. I'm trying to binding a field in a datatable to a combobox. Another table in the dataset is providing the Valuemembers and displaymembers. This field can contain nulls so I'm adding a row with a dbnull and "" into the start of the table where the Valuemembers and displaymembers are. However, when I attempt to bind to the 'SelectedValue' property I get an error:

Code:
Specified argument was out of the range of valid values. 
Parameter name: '-2147483554' is not a valid value for 'index'.

This only happens if I bind to a field that is null. If I open the form and the field is not null then it works fine. Also, in this case, if I try to change this field to the null row in the combobox then I can't leave the combobox.
I'm sure I'm missing something obvious but I've been looking at this for two days and it hasn't exactly jumped out at me:-( so any help would be greatly appreciated.
Thanks in advance,

Durkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top