Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB Databases
|
Pro VB Databases Advanced-level VB coding questions specific to using VB with databases. Beginning-level questions or issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 26th, 2008, 07:48 AM
Authorized User
 
Join Date: Oct 2007
Posts: 46
Thanks: 1
Thanked 0 Times in 0 Posts
Send a message via MSN to debbiecoates
Default selecting a row in a listview control

I have the following code on the startup on one of my forms. basically what i am doing is picking up a recordset and then adding the fields to a listview, then highlight a specific row

what i have managed to do through trial and error (as this is the first time i have used the listview control), is to highlight the first field in the row that has a visible field value of true.

This code will highlight the first field in the row, so i can at lest identify the row, but what i actually want it to do is select the whole row. Can anyone help?

many thanks

Debbie


Public Sub frmProjectLog_Startup()

Set Adodc_ProjectLog.Recordset = GetRecordset("Select * from V_ProjectLog where ProjectID = " & gURN)

Dim rs As New ADODB.Recordset
Set rs = Adodc_ProjectLog.Recordset

Dim li As ListItem

With ListView1
        .View = lvwReport
      With rs
        .MoveFirst
        Do Until .EOF
            If !Visible = True Then

                Set li = ListView1.ListItems.Add(, , Format(!Date, "dd/MM/YYYY"))
                li.ForeColor = &HFF&
                li.SubItems(1) = !Stage
                li.SubItems(2) = !User
                li.SubItems(3) = !note
                li.SubItems(4) = !ProjectNoteID
                li.SubItems(5) = !Visible
            Else
                Set li = ListView1.ListItems.Add(, , Format(!Date, "dd/MM/YYYY"))
                li.SubItems(1) = !Stage
                li.SubItems(2) = !User
                li.SubItems(3) = !note
                li.SubItems(4) = !ProjectNoteID
                li.SubItems(5) = !Visible
            End If

        .MoveNext
        Loop
    End With

End With



End Sub







Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with ListView Control in C# jiggsroger C# 2005 7 April 7th, 2008 04:25 AM
About Listview control yuetqu BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 1 August 15th, 2006 04:56 AM
problem selecting listview item method Visual C++ 0 July 7th, 2006 04:06 PM
ListView Control JelfMaria VB How-To 4 May 5th, 2005 12:39 AM
Selecting a ListView item bmains Pro VB.NET 2002/2003 0 January 22nd, 2005 11:19 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.