I have this in a database
Start§Claire Danes|Yvaine|0000132#§Sienna Miller|Victoria|1092227#§Ricky Gervais|Ferdy the Fence|0315041#§Jason Flemyng|Primus|0002076#§Mark Strong|Septimus|0835016#§Rupert Everett|Secundus|0000391#§Charlie Cox|Tristan Thorn|1214435#§Michelle Pfeiffer|Lamia|0000201#§Robert De Niro|Captain Shakespeare|0000134#§Sarah Alexander|Empusa|0018729#§Melanie Hill|Ditchwater Sal|0384514#§Joanna Scanlan|Mormo|0768936#§Kate Magowan|Slave Girl - Una|0536461#§Peter O'Toole|King|0000564#§David Kelly|Guard|0446303#End
and I this is my code.
I'm not sure if this can be done but if it can be done can someone help me out.Code:Public Function Actors() Dim lonPos As Long, lonEnd As Long Dim strStart As String, strEnd, strInfo As String Dim strSAct As String, strEAct, strName As String mystring = frmMain.Data tempString = Split(mystring, "#") num = UBound(tempString) strStart = "Start" strEnd = "End" lonPos = InStr(1, frmMain.Data, strStart, vbTextCompare) If lonPos > 0 Then lonPos = lonPos + Len(strStart) lonEnd = InStr(lonPos, frmMain.Data, strEnd, vbTextCompare) If lonEnd > 0 Then strInfo = Mid$(frmMain.Data, lonPos, lonEnd - lonPos) End If End If For i = 1 To num strSAct = "§" strEAct = "#" lonPos = InStr(1, strInfo, strSAct, vbTextCompare) If lonPos > 0 Then lonPos = lonPos + Len(strSAct) lonEnd = InStr(lonPos, strInfo, strEAct, vbTextCompare) If lonEnd > 0 Then strName = Mid$(strInfo, lonPos, lonEnd - lonPos) End If End If Next i Set a = frmMain.lstCast.ListItems.Add(, , strName) End Function
I have it count the # in the string so that is how many there will be in the listview. and then I want it to loop thru the string from the § to # and separate each one into the different listitems.
I'm not sure if I need an array and if so how do I do that or if I can loop thru it and split it somehow. pls someone help me out on what I can do.
thanks
basically it will separate like so:
Claire Danes|Yvaine|0000132
Sienna Miller|Victoria|1092227




Reply With Quote