Jump to content
Xtreme .Net Talk

How do I code so that combo box will always selected 1st before Query


Recommended Posts

Posted

Hello,

I am actually want to do validation on combobox.

It is like u make user must make choose one of the item from combo box before they procedd to do any other action like UPDATE, SAVE or DELETE.

 

In textbox, we always use IF statement

like

if (textBox1.text == "") {

//promt MsgBox ask user to input

return;

}

 

So, how we do if it is comboBox.

I also welcome anything similar, a least I can figure out an idea

thanks

Posted

Depending on how you load up/bind your combobox, you could do a check like:

if( cboSomeCombo.SelectedIndex == -1 )
{
//do your "nothing was selected" logic here
}
else
{
//continue your "good" logic, something was selected
}

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...