khowell78737
Programmer
I read the thread796-774766 that said that "comboName.Items.Insert(0,"Select")" would insert a "default" item at the top of the box.
Also in this thread, it mentioned that the insert must take place after the binding.
I'll be darned if I can get it to work.
My code is:
Public Function createStateCombo(byref combo as combobox)
<declarations and data retrieval code here>
combo.DataSource = ds.Tables("tblLookupState")
combo.ValueMember = "fldLuStateID"
combo.DisplayMember = "fldLuStateName"
combo.Items.Insert(0,"Select State")
<clean up code and error trapping here>
End Function
This does nothing but populate the combobox. There is no added item reguardless of where I put the insert line.
If I put the line in the calling procedre, I get an error that tells me I cannot insert when the datasource is set.
I'm missing something.. but what?
Thanks in advance!
Kevin Howell
Also in this thread, it mentioned that the insert must take place after the binding.
I'll be darned if I can get it to work.
My code is:
Public Function createStateCombo(byref combo as combobox)
<declarations and data retrieval code here>
combo.DataSource = ds.Tables("tblLookupState")
combo.ValueMember = "fldLuStateID"
combo.DisplayMember = "fldLuStateName"
combo.Items.Insert(0,"Select State")
<clean up code and error trapping here>
End Function
This does nothing but populate the combobox. There is no added item reguardless of where I put the insert line.
If I put the line in the calling procedre, I get an error that tells me I cannot insert when the datasource is set.
I'm missing something.. but what?
Thanks in advance!
Kevin Howell