CComboBox List Element Index

 

How do I retrieve the index of the currently selected list element?

Thank you.

 
robnorthen:

How do I retrieve the index of the currently selected list element?

Thank you.

box.Value();

this will retrieve the long value associated with the selection when you added the item to the box list

  box.AddItem("Pizza",1);
  box.AddItem("Sushi",2);
  box.AddItem("Burger",3);

So above when you select by index you would send "2" for selecting the burger , but when you actually request the value of the selection it returns 3 , or the equivalent value set upon addition.

 
Lorentzos Roussos #:

this will retrieve the long value associated with the selection when you added the item to the box list

So above when you select by index you would send "2" for selecting the burger , but when you actually request the value of the selection it returns 3 , or the equivalent value set upon addition.

Hi Lorentzos

Thank you for your solution.

Rob

Reason: