how to do string manipulation using items in listbox
hi peeps,
i am a new member here, but really would like to discuss wif all of you, after seeing how active all the conversation has been..
my question would be,
is there anyone can give me examples on how to do string manipulation(get string length, replace characters, remove characters, get string location..so on), using items in listbox (lstBox1). one example i could find is on how to add data,
lstBox1.items.add(...
but how about other manipulation? is there any solution/example?
help..
# 1 Re: how to do string manipulation using items in listbox
Hi,
here are some examples:
UserForm1.ListBox1.Clear 'Clears the listbox
UserForm1.ListBox1.AddItem "Test 1"
UserForm1.ListBox1.AddItem "Test 2"
UserForm1.ListBox1.AddItem "Test 3"
UserForm1.ListBox1.AddItem "Test 4"
UserForm1.ListBox1.ListIndex = -1 'Selects no item
UserForm1.ListBox1.ListIndex = 0 'Select first item
MsgBox Len(UserForm1.ListBox1.Text) 'Length of text of selected item
MsgBox InStr(1, UserForm1.ListBox1.Text, " ") 'Gives position of space
'starting searching from pos 1
MsgBox Replace(UserForm1.ListBox1.Text, "t", "p", 1)
'Replaces all t by p starting from posiyion 1