Reputation: 169
i need to add a N number of brackets for the selected ListItem from list boxes for a given number from a variable
. say ex. if i pass 5 from
a variable it has to add the 5 brackets
at the end of my list item values. can someone give me an idea
thanks
Upvotes: 0
Views: 99
Reputation: 460208
This is a bracket, isn't it? (
I don't know where exactly you have a problem with, but you can create a string with repeating characters with the constructor overload:
int bracketCount = 5;
string brackets = new string('(', bracketCount);
So if you want to add these brackets to the selected item in the ListBox
:
listBox1.SelectedItem.Text += brackets;
Upvotes: 1