|
-
Jan 23rd, 2002, 07:58 AM
#1
Adding rows to multi-column lstview
Hi
I have a listview with 3 columns, namelly, colX, colY,colZ.
I need to add co-ordinates to these columns from the following string:
"cord1|colX = 1,colY=2,colZ=3;cord2|colX=3,colY=4,colZ=5"
I only want to have the numbers within the string outputted in the lstview.
Can anyone give me the code to do this please.
Thanking you in advance
PORRASTAR
-
Jan 23rd, 2002, 10:15 AM
#2
Hyperactive Member
Option Explicit
Private Start As Long
Dim lUnique As Long
Private Sub FillList()
Dim s As String
Dim i As Long
Start = 1
s = "cord1|colX=1,colY=2,colZ=3;cord2|colX=3,colY=45,colZ=5"
Dim p As String
With Me.lvwFiches.ListItems
.Clear
For i = 0 To 2
lUnique = lUnique + 1
p = Getval(s, "colX=")
.Add lUnique, , p
p = Getval(s, "colY=")
.Item(lUnique).SubItems(1) = p
p = Getval(s, "colZ=")
.Item(lUnique).SubItems(2) = p
Next i
End With
End Sub
Private Function Getval(Arg As String, searchValue As String) As String
Dim i As Long
Dim j As Long
i = InStr(Start, Arg, searchValue, vbTextCompare)
j = InStr(i + 1, Arg, ",", vbTextCompare)
Getval = Mid(Arg, i + Len(searchValue), j - (i + Len(searchValue)))
Start = i + Len(searchValue)
End Function
Greetz, Luc
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|