[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Listview bold/unbold

Posted on 2002-04-28
3
Medium Priority
?
501 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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
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…
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…
Suggested Courses

834 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