Solved

Listview auto-insert to Row

Posted on 2001-06-10
3
259 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 49

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now