[program-l] Re: VB6: For Each

  • From: "Mark Long" <Mark.Long@xxxxxxxxxxxxx>
  • To: <program-l@xxxxxxxxxxxxx>
  • Date: Fri, 6 Jan 2006 12:52:10 -0000

Not problematic but there is a small error

private sub xxx(frm as form) 
        dim ctrl as object 
        for each ctrl in frm.Controls
          ctrl.enabled = false 
        next 
        end with 
end sub 

________________________________________
From: program-l-bounce@xxxxxxxxxxxxx [mailto:program-l-bounce@xxxxxxxxxxxxx] On 
Behalf Of Corbett, James
Sent: 06 January 2006 12:37
To: Program-L (E-mail)
Subject: [program-l] VB6: For Each

Hello: 
I need a quick and dirty solution... I have a form with a variety of controls 
on it ranging from command buttons to text boxes.
I wish to disable all controls on this form based upon a user level so I 
thought I would go about it thus: 
private sub xxx(frm as form) 
        dim ctrl as object 
        with frm 
        for each ctrl in frm 
        ctrl.enabled = false 
        next 
        end with 
end sub 
Ok, its early in the morning here, I have been at my desk for 20 straight 
hours, tonnes of coffee and my back teeth are floating... Is the above code 
problematic?
J. 
James M. Corbett 
(613) 941-8303 | facsimile / télécopieur 613 941-8720 | TTY/ATS 1-800-665-0354 
James.Corbett@xxxxxxxxxxxxxxx 
IT Programmer/Analyst | GST/HST Division | Information Technology Branch
Programmeur/Analyste en technologie de l'information | Division de la TPS/TVH | 
Direction générale de l'informatique
Canada Revenue Agency | 875 Heron Rd., Ottawa, ON K1A 0L5 
Agence du revenu du Canada | 875 Ch. Heron, Ottawa ON K1A 0L5 
Government of Canada | Gouvernement du Canada 

"did you exchange a walk on part in the war for a lead role in a cage" 
Pink Floyd ... "Wish you were here" 

** To leave the list, click on the immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=unsubscribe]
** If this link doesn't work then send a message to:
** program-l-request@xxxxxxxxxxxxx
** and in the Subject line type
** unsubscribe
** For other list commands such as vacation mode, click on the
** immediately-following link:-
** [mailto:program-l-request@xxxxxxxxxxxxx?subject=faq]
** or send a message, to
** program-l-request@xxxxxxxxxxxxx with the Subject:- faq

Other related posts: