Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Checkbox on 3rd Column of Listview

Posted on 2002-07-18
5
Medium Priority
?
326 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
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…
Suggested Courses

715 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