Results 1 to 3 of 3

Thread: help in vb

  1. #1
    Join Date
    Mar 2009
    Posts
    4

    Question Unanswered: help in vb

    I am writing a program for my client & I got confused........
    actully there is problem that when I make connection with database it is connected & recordset also open.
    but when I want to put values of database in listview it doesn't show..
    ....my code is as follows......

    Private Sub displayLV()
    On Error Resume Next
    Call openrecordset(Res, strRes, Cnx)
    lv1.ListItems.Clear
    With Res
    .MoveFirst
    Do While Not .EOF
    Set x = lv1.ListItems.Add(, , .Fields!lastname)
    x.SubItems(1) = .Fields!firstname
    x.SubItems(2) = .Fields!address
    x.SubItems(3) = .Fields!phno
    x.SubItems(4) = .Fields!mobileno
    x.SubItems(5) = .Fields!occupation
    .MoveNext
    Loop
    End With

    End Sub

  2. #2
    Join Date
    Jun 2004
    Location
    Arizona, USA
    Posts
    1,848
    Lou
    使大吃一惊
    "Lisa, in this house, we obey the laws of thermodynamics!" - Homer Simpson
    "I have my standards. They may be low, but I have them!" - Bette Middler
    "It's a book about a Spanish guy named Manual. You should read it." - Dilbert


  3. #3
    Join Date
    Mar 2009
    Posts
    4
    Actully I want to view my database in form also, so i use listview as a container for hold the data of database.......!!!


    Private Sub displayLV()
    On Error Resume Next
    Call openrecordset(Res, strRes, Cnx)
    lv1.ListItems.Clear
    With Res
    .MoveFirst
    Do While Not .EOF
    Set x = lv1.ListItems.Add(, , .Fields!lastname)
    x.SubItems(1) = .Fields!firstname
    x.SubItems(2) = .Fields!address
    x.SubItems(3) = .Fields!phno
    x.SubItems(4) = .Fields!mobileno
    x.SubItems(5) = .Fields!occupation
    .MoveNext
    Loop
    End With

    End Sub

    But when I set X as a object for the fields vb giving an error msg that.... for subitems ....???

    LISTITEMS--->INVALID PROPERTY VALUE

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •