flosoft
asked on
Another easy?? String Question
Problem... I want to take text from a textbox out 1 letter at a time...say to put into a list box, but I cannot find anything once again on how to do this...Is there a keyword for any character including spaces in vb?? Something like this would be fine...
Dim myString
Dim i
'X = Any and all characters in the string
myString = "XXXXXXXXXXXXXXXXXXXXX"
myString = Split(myString, "X", -1)
'Then I could add them to a listbox like:
For i = 0 To UBound(myString) - 1
List1.AddItem myString(i)
Next
This should populate the list box with single letters numbers and spaces.
The actual app will output to a Pole display, but adding to a list box is about the exact same thing.
Thanks
Dim myString
Dim i
'X = Any and all characters in the string
myString = "XXXXXXXXXXXXXXXXXXXXX"
myString = Split(myString, "X", -1)
'Then I could add them to a listbox like:
For i = 0 To UBound(myString) - 1
List1.AddItem myString(i)
Next
This should populate the list box with single letters numbers and spaces.
The actual app will output to a Pole display, but adding to a list box is about the exact same thing.
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
hi flosoft,
Dim MyString As String
MyString = "Test"
Dim i As Integer
For i = 1 To Len(MyString)
MsgBox Mid(MyString, i, 1)
Next i
hope this helps
Dim MyString As String
MyString = "Test"
Dim i As Integer
For i = 1 To Len(MyString)
MsgBox Mid(MyString, i, 1)
Next i
hope this helps
guess i should have read it more closely.
Dim MyString As String
MyString = "Test"
Dim i As Integer
For i = 1 To Len(MyString)
List1.AddItem Mid(MyString, i, 1)
Next i
Dim MyString As String
MyString = "Test"
Dim i As Integer
For i = 1 To Len(MyString)
List1.AddItem Mid(MyString, i, 1)
Next i
ASKER
Hey Vinny,
Thanks, worked perfect...I am pretty new to working with strings and am constantly running into issues lately with them... I also appreciate all others that answered my question!
Thanks!
Thanks, worked perfect...I am pretty new to working with strings and am constantly running into issues lately with them... I also appreciate all others that answered my question!
Thanks!
what about this
Dim i as long
mySting = "XXXXXXXXXXXX"
for i = 1 to Len(myString)
List1.AddItem Mid(myString, i, 1)
Next i
Good LUck!
Dim i as long
mySting = "XXXXXXXXXXXX"
for i = 1 to Len(myString)
List1.AddItem Mid(myString, i, 1)
Next i
Good LUck!
DeAn, I did not copy your code. I had this page open for a while and then submitted, by the time it went through I saw your code.
no worries supunr ;)
Private Sub Command1_Click()
Dim myString As String, mystring1 As String
Dim myString2 As String
Dim i As Integer
List1.Clear
'X = Any and all characters in the string
myString = "XXXXXXXXXXXXXXXXXXXXX"
Do Until Len(myString) = 0
mystring1 = Left$(myString, 1)
myString2 = Mid$(myString, 2)
List1.AddItem mystring1
myString = myString2
Loop
End Sub