Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning 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 October 9th, 2007, 02:01 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 180
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via ICQ to dpkbahuguna Send a message via MSN to dpkbahuguna Send a message via Yahoo to dpkbahuguna
Default Checking control types!!

HI friends!!

      I am creating runtime CheckBoxes at my Form. I have a Button also at my form and by clicking at this Button I have to Mark all the checkBoxes. I am using here For each loop and getting all the controls by this loop now I have to find that when control is CHECKBOX then i have to set its .Value property to 1.

      So please can anyone will tell me how can I get the control's type to get CheckBox from all the controls like Button, Textfileds etc.

DPK..
__________________
DPK..
 
Old October 9th, 2007, 04:12 AM
Friend of Wrox
 
Join Date: Sep 2005
Posts: 812
Thanks: 1
Thanked 53 Times in 49 Posts
Default

Hi

The following should help you

Dim ctl As Control
Dim ctlCount As Integer


Dim iTab As Integer
For Each ctl In UserForm2.Controls
    If ctl.DisplayStyle = fmDisplayStyleCheckBox Then
        MsgBox "Control is CheckBok"
    End If


Next ctl

Cheers
Shasur

http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
 
Old October 9th, 2007, 06:00 AM
Friend of Wrox
 
Join Date: Jan 2006
Posts: 180
Thanks: 1
Thanked 1 Time in 1 Post
Send a message via ICQ to dpkbahuguna Send a message via MSN to dpkbahuguna Send a message via Yahoo to dpkbahuguna
Default

thanks shasur for your reply but i have done it with this..
:)

    dim ctrl as controls
    for each ctrl in me.controls
       if typeof ctrl is CheckBox then
           msgbox "this control is checkbox."
       end if
    next

thanks agian..take care!!!
Quote:
quote:Originally posted by Shasur
 Hi

The following should help you

Dim ctl As Control
Dim ctlCount As Integer


Dim iTab As Integer
For Each ctl In UserForm2.Controls
    If ctl.DisplayStyle = fmDisplayStyleCheckBox Then
        MsgBox "Control is CheckBok"
    End If


Next ctl

Cheers
Shasur

http://www.dotnetdud.blogspot.com

VBA Tips & Tricks (http://www.vbadud.blogspot.com)
DPK..





Similar Threads
Thread Thread Starter Forum Replies Last Post
Variable types lowell VB.NET 3 July 24th, 2007 12:53 AM
Data Types Clive Astley Access 1 January 17th, 2006 04:13 PM
Data Types edward2006 Infopath 0 November 7th, 2005 06:06 PM
Types DARSIN Oracle 2 February 5th, 2005 12:14 AM





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