coding or

  • Thread starter Thread starter Jerry
  • Start date Start date
J

Jerry

Hi

I am having a bad day. I wish to code the following for the input to a
combo box:

if nothing is typed in a combo box and no items in the drop down list of the
combo box are selected then a message box will show to warn the user.

I have tried various things - using

if ((cboSimple.Text == "") & (cboSimple.SelectedIndex == -1))
if ((cboSimple.Text == "") && (cboSimple.SelectedIndex == -1))

if ((cboSimple.Text == "") | (cboSimple.SelectedIndex == -1))

if ((cboSimple.Text == "") || (cboSimple.SelectedIndex == -1))

but none of these seem to work.



I just want to make sure that the user hasn't just selected nothing in the
cboSimple box.



thanks



Doug
 
sorry

I just looked at my code and i need to leave a space between the " " and
use the && operator.

Maybe I dont even need to use the selelctedindex.

Thanks.

Doug
 
sorry

I just looked at my code and i need to leave a space between the " " and
use the && operator.

No you don't - I suspect you'll find there was a different issue.

Without a full program to reproduce the issue, it's hard to say for
sure what was wrong, however.

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top