Solved

Listview bold/unbold

Posted on 2002-04-28
3
469 Views
Last Modified: 2008-01-09
Hi,

A ListView in my code highlights unread records (Entire line (row) is in bold. I need to UNbold the selected line (row) after a given period. Can someone show me how to achieve this, please.

Thank you.
ADJ
0
Comment
Question by:ADJ2002
  • 2
3 Comments
 
LVL 12

Accepted Solution

by:
roverm earned 50 total points
ID: 6974891
This will do the trick:
Place a listview and a timer on a form (ListView1 and Timer1), then add this code:

=CODE START==============================

Option Explicit

Private Sub Form_Load()

    Timer1.Enabled = False
    Timer1.Interval = 5000 '5 seconds
   
    With ListView1
        .ListItems.Add , "item1", "item1"
        .ListItems.Add , "item2", "item2"
        .ListItems.Add , "item3", "item3"
        .ListItems("item2").Bold = True
    End With
   
End Sub

Private Sub ListView1_Click()
   
    'check to see if it's bold, then enable timer (set for 5 seconds)
    Timer1.Enabled = (ListView1.ListItems(CStr(ListView1.SelectedItem)).Bold)
       
End Sub

Private Sub Timer1_Timer()
   
    'unbold the element
    ListView1.ListItems(CStr(ListView1.SelectedItem)).Bold = False
    Timer1.Enabled = False
   
End Sub

=CODE END================================

Now the after clicking listitem 2 it will unbold after 5 seconds.

D'Mzzl!
RoverM
0
 

Author Comment

by:ADJ2002
ID: 6974963
Many thanks, roverm. Works a treat!

Regards,
   ADJ
0
 
LVL 12

Expert Comment

by:roverm
ID: 6975328
You're welcome!

D'Mzzl!
RoverM
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now