How to Display Data on List View in Vb6

This is the basic way on how to display data on a List View Control in Visual Basic 6.0, First
you must Add the control Project > Components > Microsoft Windows Common  Controls 
6.0 (SP6), then drag the List view Control: at the general tab, at View: select the Report View:

Here the sample Code:

'Declare a variable that holds for ListItem

Dim Panoy As ListItem

'set the listitem shown in the code below
   Set Panoy = ListView1.ListItems.Add(, , "Adrian")


Displaying Data from your Database:
make sure that your database connection are properly set initialize the Connection and the
Record-set,  this is done through the Do While Loop structure:

Dim Mrhumble As String ' this the string holds the query
Dim Panoy As ListItem 'holds your Listitem

With ListView1
     Set RS=New Adodb.Recordset
     Set Conn=New Adodb,Connetion
         Mrhumble="SELECT * FROM MyName"
        Rs.Open Mrhumble,Conn
           Do While Not RS.EOF
               Set Panoy=.ListItems.Add(, , Rs!FName)
                     Panoy.Subitems(1)=Rs!MI
                     Panoy.Subitems(2)=Rs!LName
              Rs.MoveNext
         Loop
End With



this is the Update of this post, due to the  request of some readers to create a
downloadable project or file, first of all i want it to show the project screen shots

                                              Figure 1.0


  the figure shown to you, on adding data from the
                               3 text boxes


                                 Figure 1.1


   this image shown to on getting the data from database

Down Load File

Hope this will Help
Happy Coding (^_^)
These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • Reddit
  • Spurl
  • StumbleUpon
  • Technorati

3 Responses to this post

  1. Anonymous on May 4, 2011 at 3:07 AM

    sir, kindly give a downloadable sample on this code.. thanx! keep on sharing

  2. Adrian A. Panoy on May 4, 2011 at 11:43 PM

    a ok!! ^_^

  3. Anonymous on July 4, 2011 at 11:30 PM

    Thank You for sharing.

    - Stephen

Leave a comment

Copyright @ Codes-47.Blogspot.Com. Powered by Blogger.