Setting values for all controls on form (1 Viewer)

Elvis

Registered User.
Local time
Today, 09:44
Joined
Sep 28, 2001
Messages
26
I am trying to set all the controls on a VB6 form. In access I am able to do the same thing and check to see if the control is a textbox, combobox, label etc and set different values dependant on what type of control it is. Here is the problem, I have CTL defined to be Control if I use CTL.ControlType = acTextbox in access it works fine if I do it in VB6 It doesn't I have tried just putting textbox or Label but in VB6 it does not seem to work.

Anyone got any ideas how I can identifiy specific types of controls in VB6
 

scottfarcus

Registered User.
Local time
Today, 09:44
Joined
Oct 15, 2001
Messages
182
Dim ctl as Control

For Each ctl In Me.Controls
If TypeOf ctl Is TextBox Then
ctl.Locked = False
ctl.Enabled = True
End If
Next ctl


This code will unlock and enable all text boxes on a VB6 form.
 

Elvis

Registered User.
Local time
Today, 09:44
Joined
Sep 28, 2001
Messages
26
Thanks for the Help. Think its the TypeOF keyword I am missing
 

Users who are viewing this thread

Top Bottom