How to show Info In a Listview

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lee123
    Contributor
    • Feb 2007
    • 556

    How to show Info In a Listview

    i am doing test program to understand how to fill a listview with information i enter in another form and also using VB6 but so far unsucessfull. in one form i am using an ADODC control to put information in an access database i have created the fields consist of ClientID, FirstName, LastName,Addres s, City, State. etc. on another form i have a Listview control. i want to know how i can get the information that i have entered in the first form onto the second form when i open it. so far i can only retrieve the fields of the first entry and not all the information in the database here is my code for the second form *Listview"

    Code:
    Private Sub Form_Load()
    Dim LHeader As ColumnHeader
    Dim LItem As ListItem
        lwidth = ListView1.Width - 5 * Screen.TwipsPerPixelX
        ListView1.ColumnHeaders.Add(1, , "ClientsID", lwidth / 7) = "Clients ID"
        ListView1.ColumnHeaders.Add(2, , "FirstName", lwidth / 4) = "First Name"
        ListView1.ColumnHeaders.Add(3, , "Lastname", lwidth / 4) = "Last Name"
        ListView1.ColumnHeaders.Add(4, , "Phone", lwidth / 5) = "Phone"
        ListView1.ColumnHeaders.Add(5, , "Cell", lwidth / 5) = "Cell"
        ListView1.View = lvwReport
        Set LItem = ListView1.ListItems.Add(1, , NewClients.ClientsID.Text)
        LItem.SubItems(1) = NewClients.FirstName
        LItem.SubItems(2) = NewClients.LastName
        LItem.SubItems(3) = NewClients.PhoneNumber
        LItem.SubItems(4) = NewClients.CellNumber
    End Sub
    how can i get the rest of the information instead of just one. for example i enter in all the fields then save then enter in another set a fields and save it so now i have two separate information but when i open up the second form there is only the first line of information and not the second one how do i get then all to show. please help me with this code i show you

    lee123
  • Kinwang2009
    New Member
    • Feb 2010
    • 22

    #2
    Hi Lee123,
    I think you are trying to load from first form to the second form. Your problem will be solved if you load ListItems from Database since you have saved your information in database.

    Thanks

    Comment

    • Kinwang2009
      New Member
      • Feb 2010
      • 22

      #3
      Hi Lee123,

      Here is my attached help.

      Good Luck
      Attached Files

      Comment

      • lee123
        Contributor
        • Feb 2007
        • 556

        #4
        kinwang2009,
        thank you for the help. and it works is there anyway you could explain this code to me. because i am not good with recordsets just from the (ADODC1) control way i would like to know a little more about this connection so i can continue to use it and understand it.

        lee123

        Comment

        • Kinwang2009
          New Member
          • Feb 2010
          • 22

          #5
          Hi Lee123,

          It will be my pleasure to explain you all but i find it is bit time consuming. In this regard I advise you to go through Connection string tutorials. If you dont understand that tutorials then I will explain through email or chat.

          I feel this connection string in simple and most efficient way to connect to your databases.

          Thankx

          Comment

          Working...