Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I created my own user control provided some get set properties like SelectedIndex,SelectedValue,SelectedItem but I need get set property for MyCombobox.Items.IndexOf(_myString), so that i can get Index proerty for my User Control

What I have tried:

public int Items[string str]
{
get
{
return myCombobox.Items.IndexOf(_myString);
}
set
{
this.myCombobox.Items.IndexOf(_myString) = value;
}
}
Posted
Comments
Ralf Meier 19-Jul-16 2:37am    
Please explain more - what do you want to get in which way ?
I suppose that you don't want to read the Items itself ...
Bernhard Hiller 19-Jul-16 3:35am    
Do you want to order the items with this property?
Member 11559270 19-Jul-16 5:38am    
i need index of the selected combobox item for that i need to write get set property
Member 11559270 19-Jul-16 5:39am    
but from above code i am getting error
Ralf Meier 19-Jul-16 15:10pm    
Because the Property itself is not programmed correct.
In fact you speak about 2 (!!!) Properties. One is your string from which you want to get the Index-Number and the other one is the Index-Number, corresponding to myString. It is not possible, to realize it with one Property. Do you understand, what I mean ?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900