Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27514

Combo Box

$
0
0
Hi,

On my form I have a combo box called 'cmbtraininglocation'. This field can be left blank on first form upload as training location is not yet selected.

At my backend SQL I have a table called -

dbo.tbltraininglocType

LocationID (PK) LocationName
1 New York
2 London
3 Toronto


Now, I called a dataset to populate the combo box on form load..

The problem is if the field was not populated at the first instance it populates New York as it is the first record on the table.

Note: the combo box has a dropdownstyle = DropDownList..

Ok performed a work around


LocationID (PK) LocationName
1 New York
2 London
3 Toronto
4

New locationId = 4 with empty string, then I ordered by LocationName.. This resolved the problem and on form load if the combo box is emoty at the backend I do get an empty combo box.

However, the combo box appears like

Empty Space
London
New York
Toronto

The annoying bit is the Empty space, which serves the purpose, but also as it is top on the list of selection will ignite wrong selection in some occassions. Also, having an ampty space in the backend table is NOT neat..

Any suggestions please..

Many thanks

Viewing all articles
Browse latest Browse all 27514

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>