Jump to content
  • Advertisement
Sign in to follow this  

[.net] ComboBox 'checked'

This topic is 4413 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a checkbox user control and have made a ComboBox based on the same code (partly). The problem occurs when I have:
if(Checked)
{
    //draw toggled
}
else if(!Checked)
{
    //don't draw toggled
}
The ComboBox class dosn't have Checked and I wasn't sure what the property was to say its been pressed ect. Does any one know it?

Share this post


Link to post
Share on other sites
Advertisement
Look at the Selected* properties (SelectedIndex, SelectedItem, SelectedValue, SelectedText).

Share this post


Link to post
Share on other sites
If(CB.SelectedIndex!=-1)

or

If(CB.SelectedItem!=null)

these are the cases, when there is something (an item in the list) selected in the combobox.

I suggest creating a new control:

class myComboBox : ComboBox
{
Bool Checked
{
get
{
return CB.SelectedItem!=null;
}
}
}

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!