Solved

Listview bold/unbold

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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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…
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…
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…

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