Solved

Checkbox on 3rd Column of Listview

Posted on 2002-07-18
5
317 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
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…
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…

752 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