Click to See Complete Forum and Search --> : Making textbox and combobox visible
darian
Nov 10th, 1999, 05:55 PM
I need to have a textbox and a combobox to be invisible to start but if someone clicks on the Optionbutton "Yes" to have them the textbox and combobox to be visible. I have tried several variations of the code below but none seem to work. Any help me?
Private Sub Upgrade_Click()
If Upgrade(1).Value = 1 Then
UpgradeDate.Visible = True
UpgradeDateLabel.Visible = True
UpgradeTo.Visible = True
UpgradeToLabel.Visible = True
End If
End Sub
Thanks.
------------------
Stanley
Mark Sreeves
Nov 10th, 1999, 06:01 PM
Upgrade(1) looks like it's an array but
Private Sub Upgrade_Click() doesn't
maybe you're putting the code in the wrong place!
------------------
Mark Sreeves
Analyst Programmer
Mark.Sreeves@Softlab.co.uk
A BMW Group Company
darian
Nov 10th, 1999, 07:33 PM
Ok ignoring my code above do you know of anyway to do what I am trying to do?
------------------
Stanley
Serge
Nov 10th, 1999, 08:01 PM
Ok, lets start from the beginning. You have an empty form. When you add an Option button to the form, the name of this Option button would be Option1 (by default) and when you add command button it would be Command1 (by default). Same with Textbox - it would be Text1. So, lets assume that you have added those controls to your form (Option1, Option2 (this one is to hide controls again) Command1, Text1)
Private Sub Form_Load()
Option1.Caption = "&Show controls"
Option2.Caption = "&Hide controls"
Option1.Value = True
End Sub
Private Sub Option1_Click()
Command1.Visible = True
Text1.Visible = True
End Sub
Private Sub Option2_Click()
Command1.Visible = False
Text1.Visible = False
End Sub
Note: Of course, you better create a Control Array (for Option button).
Regards,
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
Crazy D
Nov 10th, 1999, 08:01 PM
textbox.visible = optionbutton.value
combobox.visible = textbox.visible
put this in the click event of the optionbutton
Serge
Nov 10th, 1999, 08:18 PM
Crazy D's code will work only if you have more then 1 option button. Because, if you have only one, then you woun't be able to change the option value back to FALSE.
Regards,
------------------
Serge
Software Developer
Serge_Dymkov@vertexinc.com
Access8484@aol.com
ICQ#: 51055819 (http://www.icq.com/51055819)
V138
Nov 11th, 1999, 01:39 AM
Did you try:
OptionButton_Click()
if OptionButton.Value = True then
combobox.visible = true
textbox.visible = true
endif
end sub
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.