Solved

Listview auto-insert to Row

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb script Microsoft Word tables portion of based on bookmark, count and add rows 1 48
Paint/Redraw window while dragging 16 68
Using "ScreenUpdating" 6 55
Advice in Xamarin 21 56
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…
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…

910 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

20 Experts available now in Live!

Get 1:1 Help Now