determine combobox item is selected

if i populate combobox with sqldataadapter and sqldatatable then how can i determine weather combobox has selected item or empty

[135 byte] By [IIM] at [2007-12-28]
# 1
Check this:


if (myCombo.SelectedItem == null)
{
//item not selected, do something, set error in error provider for combo, set the focus to the como or something else like message box.
}

boban.s at 2007-9-4 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2

Extra info:

myCombo.SelectedIndex will be -1 if nothing is selected.

Greetz,

Geert

Geert Verhoeven
Consultant @ Ausy Belgium

My Personal Blog

GeertVerhoeven at 2007-9-4 > top of Msdn Tech,Windows Forms,Windows Forms General...