Solved

Listview bold/unbold

Posted on 2002-04-28
3
475 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

840 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