0

Hey Guys! ,
Im having a bit of a problem here. I need to add a certain string in this case (') infront of every item in my listbox.

So lets say items are :
item1
item2
item3
item4

After i execute a code i want it to be
item1'
item2'
item3'
item4'

It would be highly appreciated if someone could help me out here!. Thanks alot

3
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by Oxiegen
-1

Just hardcoded the data with single quotes

lstView.Items.Add("CSharp'");
        lstView.Items.Add("Vb'");

Or
U can get data from backend and using the loop jus concate the backend data with "'" and add into listbox.

0

Hey when i do that it doesnt work. All it does is that it adds to items ( csharp' and vb')

thanks

0

If your listbox already contains items then this should work:

For i As Integer = 0 To lstBox.Items.Count - 1
   lstBox.Items(i) = lstBox.Items(i) & "'"
Next

Or if you need to add ' while adding items then this is the way to go:

lstBox.Items.Add(<some source> & "'")
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.