Wrox Programmer Forums
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To 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 May 9th, 2004, 06:58 AM
Registered User
 
Join Date: May 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default checkbox in datagrid

Does anyone know how to display a checkbox in a datagrid using VB6?
The field that i want to display as a checkbox is coming from a access database and is marked as a yes/no datatype.

many thanks in advance

joekske
 
Old June 3rd, 2004, 02:31 PM
Authorized User
 
Join Date: Dec 2003
Posts: 20
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm using a flexgrid (which I've been told is similar to a datagrid). What you need to do is add code to the grids startedit method that checks to see if the column selected is the one that you want to display a checkbox in. If it is you take control away from the flexgrid.

Here's the code I have that checks to see if the column clicked is the that's displaying the date.

    If VSFlexGrid1.ColDataType(Col) = flexDTDate Then

        ' we'll handle the editing ourselves
        Cancel = True

        ' position date picker control over cell
        DTPicker.Move VSFlexGrid1.CellLeft, VSFlexGrid1.CellTop, VSFlexGrid1.CellWidth, VSFlexGrid1.CellHeight

        ' initialize value, save original in tag in case user hits escape
        If VSFlexGrid1.Cell(flexcpText, Row, Col) <> "" Then
            DTPicker.Value = VSFlexGrid1.Cell(flexcpText, Row, Col)
        Else
            DTPicker.Value = WeekOf

        End If
        DTPicker.Tag = VSFlexGrid1

        ' show and activate date picker control
        DTPicker.Visible = True
        DTPicker.SetFocus

        ' make it drop down the calendar
        SendKeys "{f4}"





Similar Threads
Thread Thread Starter Forum Replies Last Post
CheckBox in Datagrid sumith ASP.NET 1.0 and 1.1 Professional 1 March 21st, 2007 06:25 AM
checkbox in datagrid asad_prog VB.NET 0 November 25th, 2006 02:41 PM
Checkbox in the datagrid sadermine VB Components 0 August 16th, 2005 10:36 PM
CheckBox in DataGrid Baby_programmer ASP.NET 1.x and 2.0 Application Design 2 March 11th, 2005 12:42 AM
CheckBox in DataGrid Baby_programmer ASP.NET 1.0 and 1.1 Basics 1 March 3rd, 2005 08:33 PM





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