Row Goes Empty while looping..

BILAL69
BILAL69 used Ask the Experts™
on
please check this code
Well i can sort up contact list as online/offline like this....
 
 
    Dim theContacts$
    theContacts = Mid(str, 36)
'-------------------------------------------------------
'contact list comes from server like below
 
;infomamun%2;hitman%1;aqib%2;mak99%2;kylie%2;x420%1;n.e.o%2;rel_%2;dage%2;iftikhar-khan%2;xdragon%2;yasamin%2;matric-fail%2;fuji%2;jaah%2;125.%2;dreaming....%2;bejad%2;str4nger-%2;tiwul%1;k1ngz%2;rainbow_prince%2;flash_bak%2;onk.%2;dude-%2;genuine%2;awara%2;ax-_%2;spasi%2;kheera%1;a.t.c%2;akib%2;geronimo%2;akiz%2;endang.soekamti%2;sazzad%2;xumanx%2;samitte%2;kamran%2;asad%1;tsn.%2;namhin%2;zatak%2;yayans%2;0-zi%2;kang_guru%1;bejox%2;z.hu%2;cban%2;smba%2;vodoo%2;dr.x.%2;joyo_bledex%2;juz_clarissa%2;st--%2;cewe-_%2;staff.zaka%2;pixi_123%2;fadola%2;mustho%2;d.e.a.t.h.z%2;romim%2;dubes%2;pari%2;mr.affair%2;hitler%2;naqvi%2;lifes%2;gw...%1;babyfairy%2;l0vely-shan%2;little.shadow%1;kimpul%2;fra.%2;tio3%2;sa33%2;sira%2;0.f.%2;aktel.786%2;
 
then it is sorted to line by line method below...
 
 
 
 
 
    Dim x, tmp() As String, theOnline As String
    tmp() = Split(theContacts, ";")
    Dim NUM_ROWS  As Integer, i As Integer
    NUM_ROWS = UBound(tmp)
    ContactList.Rows = NUM_ROWS
    ContactList.Cols = 2
    ContactList.GridLines = flexGridNone
    ContactList.SelectionMode = flexSelectionByRow
    ContactList.RowHeightMin = imgOnline.Height + _
        ScaleY(2, vbPixels, vbTwips)
    ContactList.ColWidth(0) = imgOnline.Width
    ContactList.ColWidth(1) = 5000
    ContactList.Clear
    For i = 1 To NUM_ROWS
            On Error Resume Next
    theOnline = Split(tmp(i), "%")(0) & " - " & Split(tmp(i), "%")(1)
        Debug.Print theOnline
    
 
        If InStr(theOnline, " - 1") Then
        ContactList.Row = i - 1
        ContactList.Col = 0
        Set ContactList.CellPicture = imgOnline.Picture
        ContactList.Col = 1
        ContactList.TextMatrix(i - 1, 1) = Format$(Split(theOnline, " - ")(0))
        ContactList.Refresh
        Else
        ContactList.Refresh
        ContactList.Row = i - 1
        ContactList.Col = 0
        Set ContactList.CellPicture = imgOffline.Picture
        ContactList.Col = 1
        ContactList.TextMatrix(i - 1, 1) = Format$(Split(theOnline, " - ")(0))
        End If
    Next i
    End If
 
 
now some of the line goes empty like u can see in picture:
[IMG]http://i32.tinypic.com/k3ljdg.jpg[/IMG]

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Author

Commented:
also i forgot to mention im using Flexgrid control


good evening!

remove the On error resume next
on the code for us know where the code error is...


game-master

Author

Commented:
it occurs on splitting some  time tmp(i) goes empty... so i put it like

    If tmp(i) = "" Then
    DoEvents
    Else
    theOnline = Split(tmp(i), "%")(0) & " - " & Split(tmp(i), "%")(1)
    Debug.Print theOnline
    End If

but still the same actually  when i double click on that row private msg windows appear and user name also appear but that row still look empty
Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!



'try this approach...

Private Sub Form_Load()
    formatContactList
End Sub

Sub formatContactList()
    With contactlist
        .rows = 1
        .Cols = 2
        .ColWidth(0) = 2000
        .ColWidth(1) = 2000

        .TextMatrix(0, 0) = "My Column One"
        .TextMatrix(0, 1) = "My Column Two"
       
    End With
   
End Sub

'TO add item on the ContactList...
Sub addContact()
   
    For i = 1 To contactlist.rows - 1
        theOnline = Split(tmp(i), "%")
        With contactlist
            .AddItem theOnline(0) & vbTab & theOnline(1)
        End With
    Next
End Sub

Author

Commented:
yea but in colums 1 i need imgonline.picture too

Author

Commented:
Column 0 **


to add picture on the column 0 try sumthing like this...


With contactlist
        For i = 1 To .Rows - 1
            .Col = 0
            .Row = i
            Set .CellPicture = LoadPicture("D:\picture\test.jpg")
        Next
End With


game-master

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial