aplelois
asked on
error
why do I get an error in here?
Public Function Parse(ByRef sIn As String, ByRef sDel As String) As Object
Dim s, i, x, t As Short
i = 1 : s = 1 : t = 1 : x = 1
Dim tArr(x) As Object
If InStr(1, sIn, sDel) <> 0 Then
Do
ReDim Preserve tArr(x)
tArr(i) = Mid(sIn, t, InStr(s, sIn, sDel) - t)
t = InStr(s, sIn, sDel) + Len(sDel)
s = t
If tArr(i) <> "" Then i = i + 1
x = x + 1
Loop Until InStr(s, sIn, sDel) = 0
ReDim Preserve tArr(x)
tArr(i) = Mid(sIn, t, Len(sIn) - t + 1)
Else
tArr(1) = sIn
End If
Parse = VB6.CopyArray(tArr)
End Function
Public Function Parse(ByRef sIn As String, ByRef sDel As String) As Object
Dim s, i, x, t As Short
i = 1 : s = 1 : t = 1 : x = 1
Dim tArr(x) As Object
If InStr(1, sIn, sDel) <> 0 Then
Do
ReDim Preserve tArr(x)
tArr(i) = Mid(sIn, t, InStr(s, sIn, sDel) - t)
t = InStr(s, sIn, sDel) + Len(sDel)
s = t
If tArr(i) <> "" Then i = i + 1
x = x + 1
Loop Until InStr(s, sIn, sDel) = 0
ReDim Preserve tArr(x)
tArr(i) = Mid(sIn, t, Len(sIn) - t + 1)
Else
tArr(1) = sIn
End If
Parse = VB6.CopyArray(tArr)
End Function
what do u want to do?
ASKER
I have a listbox and a button, I want to collect the IDs from my email into the listbox so when I click the button
I will see all the IDs inside the listbox like this
12356
3265
356698
3264486
etc....
this is my other code
Function ParseIt(ByRef Expression As String, ByRef DelimiterA As String, ByRef DelimiterB As String) As Object
Dim A, B As Integer
A = 1
While InStr(A, Expression, DelimiterA) > 0
A = InStr(A, Expression, DelimiterA) + Len(DelimiterA)
B = InStr(A, Expression, DelimiterB)
ParseIt = Mid(Expression, A, B - A)
End While
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.Items.Clear()
Dim TheRealList As String
Dim TheFinishedList As String
TheRealList = WebBrowser1.Document.DomDo cument.doc umentEleme nt.InnerHT ML
TheFinishedList = ParseIt(TheRealList, "main.asp?MailID=", Chr(34) & ">")
Dim A As Object
Dim i As Short
i = 1
A = Parse(TheFinishedList, ",")
For i = 1 To UBound(A)
ListBox1.Items.Add(A(i))
Next i
End Sub
I will see all the IDs inside the listbox like this
12356
3265
356698
3264486
etc....
this is my other code
Function ParseIt(ByRef Expression As String, ByRef DelimiterA As String, ByRef DelimiterB As String) As Object
Dim A, B As Integer
A = 1
While InStr(A, Expression, DelimiterA) > 0
A = InStr(A, Expression, DelimiterA) + Len(DelimiterA)
B = InStr(A, Expression, DelimiterB)
ParseIt = Mid(Expression, A, B - A)
End While
End Function
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
ListBox1.Items.Clear()
Dim TheRealList As String
Dim TheFinishedList As String
TheRealList = WebBrowser1.Document.DomDo
TheFinishedList = ParseIt(TheRealList, "main.asp?MailID=", Chr(34) & ">")
Dim A As Object
Dim i As Short
i = 1
A = Parse(TheFinishedList, ",")
For i = 1 To UBound(A)
ListBox1.Items.Add(A(i))
Next i
End Sub
ASKER
but is not working!!
ASKER
Error 1 Name 'VB6' is not declared.
Warning 2 Function 'ParseIt' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.
Warning 2 Function 'ParseIt' doesn't return a value on all code paths. A null reference exception could occur at run time when the result is used.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Yes, Fernando thats what I was looking for it works.. thanks
check this one out http:Q_21843101.html
check this one out http:Q_21843101.html
ASKER
Fernando, I think you are the only one who can help me http:Q_21843102.html