Hi all. i am using the following code to populate my listbox. I wonder how i can modify it so i populate listview instead. My query for listbox outputing one item but for my listview has to output more then one item. I be happy if some one show me how this can be done.Thanks
qury for the listview:
select url,author,image,title from videos22 Code:
Private Sub Form_Load() 'Open connection Dim CNN As ADODB.Connection Dim RS As ADODB.Recordset Set CNN = New ADODB.Connection CNN.Open "DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost;DATABASE=test;USER=root;PASSWORD=;OPTION=3;" 'get records to recordset Set RS = CNN.Execute("select url,author,image,title from videos2", , adCmdText) 'go through all the records until you get to 'the end (rs.EOF = True) Do Until RS.EOF = True 'Add the records to your listbox 'ShowScrollBar List2.hwnd, SB_HORIZONTAL, True List2.AddItem RS!URL 'start from the first record and then go through them all 'using .MoveNext RS.MoveNext 'get all records (loop) Loop RS.Close Set RS = Nothing CNN.Close Set CNN = Nothing 'horizantal scroll bar 'List1.AddItem "set the right margin to 3 times the width of the control" SendMessage List2.hwnd, LB_SETHORIZONTALEXTENT, ScaleX(List2.Width * 3, Me.ScaleMode, vbPixels), 0 ShowScrollBar List2.hwnd, SB_HORIZONTAL, 1 End Sub




Reply With Quote