Results 1 to 2 of 2

Thread: ListView Code

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 1999
    Location
    England
    Posts
    982
    I need to confirm what you are asking to help you as specifically as possible.

    Firstly I presume you are using the listview in report style (rows and columns).

    You have 2 recordsets and a listview control. You want to display the first column of the second recordset. What position will this column be in the listview in relation to the other columns from the first recordset? and you want to display all but the first column of the first recordset. Is there some link between these recordsets?


    Things I do when I am bored: DotNetable

  2. #2
    I figured it out. The Listview was showing the two queries at different times, depending on which one they wanted to see, not at the same time. I was having trouble getting the first column to show on the second query, because the code was written to not show the first column on the first query. I had to figure out how to add the columnheader and then the data for the second query. I figured that out, it only need to have a few changes, and then used an IF statement to direct the queries to the correct code. The code for the second query is now:

    For i = 0 To rsListData.Fields.Count - 1
    Me.ctlViewCust.ColumnHeaders.Add _
    , _
    "Column" & i, _
    rsListData.Fields(i).Name
    Next i

    If Not rsListData.EOF Then
    sEditID = rsListData.Fields(0)
    End If


    Do While Not rsListData.EOF
    Set itemReturned = Me.ctlViewCust.ListItems.Add( _
    , _
    "Item" & rsListData.Fields(0), _
    rsListData.Fields(0))
    For i = 1 To rsListData.Fields.Count - 1

    itemReturned.SubItems(i) = _
    rsListData.Fields(i) & ""
    Next i
    rsListData.MoveNext

    Loop


    Not much of a change, just needed to figure what little changes to make. Thanks anyway!

    Tim

    VB6, SP4
    GT Vengeance

Posting Permissions

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



Click Here to Expand Forum to Full Width