Label on User Form visible

G

Gimp

I have what I think is an easy one, but I'm stuck.

I have a user form were the user is required to make selections in 3
fields, 2 comboboxes and 1 text box. I've placed a label above all
three. The first one is set to visible.true, the other two set to
visible.false. The first one has text: "Enter Origin First". When
the user selects an item from combobox1, then set label1 to
visible.false, and label2 visible.true and so on...kind of like having
a bit of instruction as the user moves from one field to the next.

I've tried code in the label something like:

private sub label1_click()
if combobox.text <> "" then
label1.visible = False
End if

Nothing happens tho, any suggestions?

Thanks
 
G

Guest

I used .hide on one of my programs and it worked. Yoou don't need the =
False

Hide and Visiabble should work

The hide shouldn't be against the label, it should be on the textbox.
 
G

Guest

I am not sure what Joel is working with, but I didn't see a hide property or
method for labels used on Userforms.

Private Sub Userform_Initialize()
Label1.Visible = True
Label2.Visible = False
Label3.Visible = False
End sub

Private Sub Combobox1_Click()
Label1.Visible = False
Label2.Visible = True
Label3.Visible = False
End Sub

Private Sub Combobox2_Click()
Label1.Visible = False
Label2.Visible = False
Label3.Visible = True
End Sub


Private Sub Textbox1_Exit()
Label1.Visible = False
Label2.Visible = False
Label3.Visible = False
End Sub

This only works if the user moves sequentially through your data as you
expect. You could also hide the related controls (you don't want selected)
as well using the same approach.
 
G

Gimp

I am not sure what Joel is working with, but I didn't see a hide property or
method for labels used on Userforms.

Private Sub Userform_Initialize()
Label1.Visible = True
Label2.Visible = False
Label3.Visible = False
End sub

Private Sub Combobox1_Click()
Label1.Visible = False
Label2.Visible = True
Label3.Visible = False
End Sub

Private Sub Combobox2_Click()
Label1.Visible = False
Label2.Visible = False
Label3.Visible = True
End Sub

Private Sub Textbox1_Exit()
Label1.Visible = False
Label2.Visible = False
Label3.Visible = False
End Sub

This only works if the user moves sequentially through your data as you
expect. You could also hide the related controls (you don't want selected)
as well using the same approach.

--
Regards,
Tom Ogilvy










- Show quoted text -

Thanks...Yep, I got it. I did not see the HIDE option either but just
switched my code from the label to the combox boxes....all good. And
yes, I'm gonna play around with using this on the combo boxes instead
of the labels...want to make sure it looks OK...thanks again...!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top