HI friends,
Is there a possibility to refer to item by its number (in Combobox)?

For example, I read all combobox items from a file.
and I need to do sth like that:

if (comboBox1->Itemnumber=1) then {Action}

I don't want to refer to the text in the combobox to make a condition.

thx for help!

Recommended Answers

All 4 Replies

comboBox1->SelectedIndex will give you the zero-based index of the item you've selected. Probably you were just in a rush, but you want the == instead of = in your line of code above.

Yeah thats exactly what I was looking for :)
thx mate once again!.

No prob. If you haven't been over to MSDN you should check it out as there's every little detail of .NET mapped out (not that I mind answering your questions at all).

Yeah I have found it, but you were faster with your answer
so I couldnt close the thread before..
MSDN is a first place I start searching :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.