Solved

Checkbox on 3rd Column of Listview

Posted on 2002-07-18
5
300 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
ID: 7161843
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
ID: 7161860
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
ID: 7163089
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
ID: 8013960
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
ID: 8095644
Question placed in PAQ

Computer101
E-E Admin
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

778 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