Solved

Checkbox on 3rd Column of Listview

Posted on 2002-07-18
5
279 Views
Last Modified: 2008-03-17
I want to display a listview with the check box being displayed in the 3rd column.
eg

Name         Age     Close
-------     -----   ---------
Mary         28      [] (<- this being the checkbox)

At the moment I can only seem to get the checkbox value in the first column
Here is the code I have at the moment:
Dim itmAdd As ListItem
lvwList.View = lvwReport
lvwList.Checkboxes = True
lvwList.ColumnHeaders.add , , "Namw", lvwList.Width / 3
lvwList.ColumnHeaders.add , , "Age", lvwList.Width / 3
lvwList.ColumnHeaders.add , , "Close", lvwList.Width / 3
Set itmAdd = lvwList.ListItems.add(, , "Mary")
itmAdd.SubItems(1) = "28"

Any suggestions???
0
Comment
Question by:amgavin
5 Comments
 
LVL 2

Expert Comment

by:priya_pbk
Comment Utility
I think that is the default property of the Listbox, ie Style=1 Checkbox which makes the checkbox to the extreme left and not in any columns

maybe you can try a workaround...

-priya

0
 
LVL 2

Expert Comment

by:priya_pbk
Comment Utility
sorry it should be ListView

The default property of the ListView, ie checkbox=true which makes the checkbox to the extreme left.

Also i think you might be wanting to read those values which are checked by the user, why not at run time, read those elements who's checkbox is checked.

hope this helps!

-priya

0
 
LVL 4

Expert Comment

by:gencross
Comment Utility
I don't think you are going to be able to have a checkbox in a subitem.

Alternatively you could use the itemclick event and just change 'Close' to true or false or yes or no when the item is clicked...

Private Sub lvwList_ItemClick(ByVal Item As MSComctlLib.ListItem)
   
    If Item.SubItems(2) = "Yes" Then
        Item.SubItems(2) = "No"
    Else
        Item.SubItems(2) = "Yes"
    End If
   
End Sub

Once the user is finished choosing iterate through the list checking to see which are "Yes" and which are "No" and do what you want to with them.
0
 
LVL 49

Expert Comment

by:DanRollins
Comment Utility
Hi amgavin,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Refund points and save as a 0-pt PAQ.

amgavin, Please DO NOT accept this comment as an answer.
EXPERTS: Post a comment if you are certain that an expert deserves credit.  Explain why.
==========
DanRollins -- EE database cleanup volunteer
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
Comment Utility
Question placed in PAQ

Computer101
E-E Admin
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

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…
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 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…

762 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