Solved

Listview bold/unbold

Posted on 2002-04-28
3
476 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

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.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

740 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