Solved

Listview auto-insert to Row

Posted on 2001-06-10
3
283 Views
Last Modified: 2006-11-17
Greetings,

I need the following to occur, but am having difficulty making it happen.

I have a Listview set up with multiple Rows and 2 Columns. A name is entered into the first Column by the user.

If the Listview Count = 1 only, I need the second Column to auto-update with the word 'Default'.
I have tried SendKeys to get the focus into the first Row, but this doesn't always work. Can someone please suggest a better way.

Thank you.

Regards,
   Tony

0
Comment
Question by:tvtech
3 Comments
 
LVL 50

Expert Comment

by:Ryan Chong
ID: 6175486
Hi, use listview1.listitems(i).selected = true; i = listview.listitems.index

0
 
LVL 43

Accepted Solution

by:
TimCottee earned 175 total points
ID: 6176297
Private Sub ListView1_AfterLabelEdit(Cancel As Integer, NewString As String)
    If ListView1.ListItems.Count = 1 Then
        ListView1.ListItems(1).SubItems(1) = "Default"
    End If
End Sub


Is all you need, this detects that the column label has changed, and if there is only one item then the second column is set to "Default", nothing happens if there is more than one row.
0
 

Author Comment

by:tvtech
ID: 6177808
Thanks very much for the response. Much appreciated.

Regards,
   Tony
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
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…
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…

776 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