Thanks to @Kem Tekinay , I have successfully added the data I need from my RegEx match to a TextField.
Ultimately, I need the data to go into an 8-column listbox.
Currently my code is:
[code]
//Regex stuff
Dim rg as New RegEx
Dim myMatch as RegExMatch
rg.SearchPattern="(?mi-Us)(?|""([^""]*)""|(\d+)|(null))"
myMatch = rg.Search(s) //searches the returned shell string
//display results in listbox
do
if myMatch <> nil then
lstBoxImages.AddRow(myMatch.SubExpressionString(1))
myMatch=rg.Search
end if
loop until myMatch is Nil[/code]
This adds each entry as a new row obviously. How do I get each entry in 1 row, and its own column?
Start with lb.AddRow( “” ), then keep a counter for the column. After each match, increment the column counter and use lb.Cell( 0, col ) to set the value of that column.
do
if myMatch <> nil then
lstBoxImages.AddRow(myMatch.SubExpressionString(1))
myMatch=rg.Search
colCount = colCount + 1
lstBoxImages.Cell(0, colCount)
end if
loop until myMatch is Nil
Like this?
It’s throwing an error saying there is more than one item with this name…Referring to: lstBoxImages.Cell(0, colCount)
lstBoxImages.DeleteAllRows
lstBoxImages.AddRow ""
dim col as integer = -1
while myMatch <> nil
col = col + 1
lstBoxImages.Cell( 0, col ) = myMatch.SubExpressionString(1)
myMatch=rg.Search
wend
while myMatch <> nil
col = col + 1
lstBoxImages.Cell( 0, col ) = myMatch.SubExpressionString(1)
myMatch=rg.Search
wend
[/code][/quote]
oh ok. How come col is set to -1?