Hi
I need to split data from a datagrid column say
Brown John E & Jane P
How do I get around this I think it may be lBound\uBound but I could not get this to work.
How can I put this in an If Statement?
Can you help please?
I need to split data from a datagrid column say
Brown John E & Jane P
Code:
VB6
Option Explicit
Private sNamePart() As String 'array of strings
Private s As String
s = Brown John E & Jane P
Private Function mySplitName()
Dim i As Integer
sNamePart = Split(s, " ") 'split string up by spaces
For i = LBound(sNamePart) To UBound(sNamePart)
' Debug.Print sNamePart(i) 'Testing Only
Next i
s = vbNullString
End Function
Result
sNamePart(0) = "Brown"
sNamePart(1) = "John"
sNamePart(2) = "E"
sNamePart(3) = "&"
sNamePart(4) = "Jane"
sNamePart(5) = "P"
I can then add the parts to the textbox
txtA.Text = sNamePart(0) = "Brown"
txtB.Text = sNamePart(1) = "John"
But if sNamePart(3) = Out of range or Empty
How can I put this in an If Statement?
Can you help please?