Saturday 15 March 2014

c# - Check if combobox value is empty -



c# - Check if combobox value is empty -

i have created combobox 3 values. wanted message box opens when no item selected tried this:

if (combobox1.selecteditem == null) { messagebox.show("please select value"); return; }

that works fine if click field in combobox. when dont touch it, programme start without message box. whats wrong?

if (string.isnullorempty(combobox1.text)) or if (combobox1.selectedindex == -1)

c# winforms combobox

No comments:

Post a Comment