Wrox Programmer Forums
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 3rd, 2005, 03:42 AM
Authorized User
 
Join Date: Jan 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default ListViews and Checkboxes

Hi Folks,

Another post!?

Does anyone know how to put a checkbox into a listview??

I have a listview with 3 columns (Name, Address, Mailing List) and I would like to add a checkbox into the Mailing List column.

Can this be done and, is so, how? I have been looking in some books for this, but they all seem cover adding a checkbox to the first column using the properties, but there doesnt seem to any mention of adding it to another column.

As always, ideas, thoughts and tip are gratefully receieved!

Morris



 
Old June 3rd, 2005, 01:15 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The standard ListView does not allow that.
What I do, is to use a FlexGrid. I created a checkboxOn and checkboxOff icons, and I display them using the CellPicture property. In the MouseDown even, I check if the mouse is on the region where a picture is, and if yes I toggle it. It is easy and much cheaper than a third party component (there are a lot of grid componets out there, but the good one are pricy and usually they have away much more feature than some usully needs)
Marco
 
Old June 6th, 2005, 06:11 AM
Authorized User
 
Join Date: Jan 2004
Posts: 66
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Folks,

Just to tidy things up a little;

While it is not possible to add a checkbox to anyother column than column 1, it is possible move column positions using the code below:

If (MailingList = "Y") Then

   'Set Checkbox to true
   listView1.ListItems.Item(piListItem).Checked = True

End If

   'Change position of the columns
   'Checkbox Column moved to column 3
   listView1.ColumnHeaders.Item(1).Position = 3

   'Column 2 moved to column 1
   listView1.ColumnHeaders.Item(2).Position = 1

   'Column 3 moved to column 2
   listView1.ColumnHeaders.Item(3).Position = 2


Hope this proves useful,

Morris

 
Old January 9th, 2006, 07:12 AM
Registered User
 
Join Date: Jan 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey,
    is tis a VB.NET code..I tried using tis...but it says..column headers is not accessible because it is private..Please help me as i am a beginner in .NET..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Scrolling ListViews simultaneously. Saju_K .NET Framework 1.x 0 April 27th, 2007 01:50 AM
Gridview with checkboxes kgaughan1 ASP.NET 2.0 Professional 0 February 11th, 2007 11:31 PM
Loop through checkboxes Godko Visual Studio 2005 1 April 9th, 2006 11:32 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.