Hi All,
Can any one help me with the following please. My code below does not seems to work.
1. Disable all controls on form load - I have various controls (textboxes, listboxes, comboboxes, Tabcontrols etc) on a form and I need to disable these controls at form load. The code I used for this does not seems to work as some of the controls are inside TAB/Panel controls. Is there a different way to do this?
Dim ctrl as control
For Each ctrl In me.Controls
If TypeOf ctrl Is TextBox Then ctrl.Enabled = False
If TypeOf ctrl Is ComboBox Then ctrl.Enabled = False
If TypeOf ctrl Is ListBox Then ctrl.Enabled = False
Next
================================================
2. How to set listindex (to -1) of all comboboxes in a form?
Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is ComboBox Then ctrl.listindex = -1
Next
Any help resolving above greatly appreciated.
Thanks
Can any one help me with the following please. My code below does not seems to work.
1. Disable all controls on form load - I have various controls (textboxes, listboxes, comboboxes, Tabcontrols etc) on a form and I need to disable these controls at form load. The code I used for this does not seems to work as some of the controls are inside TAB/Panel controls. Is there a different way to do this?
Dim ctrl as control
For Each ctrl In me.Controls
If TypeOf ctrl Is TextBox Then ctrl.Enabled = False
If TypeOf ctrl Is ComboBox Then ctrl.Enabled = False
If TypeOf ctrl Is ListBox Then ctrl.Enabled = False
Next
================================================
2. How to set listindex (to -1) of all comboboxes in a form?
Dim ctrl As Control
For Each ctrl In Me.Controls
If TypeOf ctrl Is ComboBox Then ctrl.listindex = -1
Next
Any help resolving above greatly appreciated.
Thanks