Textboxes and labels in Userform??

T

TotallyConfused

I have the following code for a userform. However, I want to know if I can
add another label with descriptions. Instead of one label being visible I
would like two labels to be visible when mouse moves over the textbox. Can
this be done? If so how do I add this to the code below. I would add
another label to all the textboxes. Thank you for any help you can provide.


Private Sub UserForm1_MouseMove(ByVal Button As Integer, ByValShift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Label1.Visible = True
Me.Label1.Visible = False
Me.Label2.Visible = True
Me.Label2.Visible = False
Me.Label3.Visible = True
Me.Label3.Visible = False
Me.Label4.Visible = True
Me.Label4.Visible = False
Me.Label5.Visible = True
Me.Label5.Visible = False
Me.Label6.Visible = True
Me.Label6.Visible = False
Me.Label7.Visible = True
Me.Label7.Visible = False

End Sub

Private Sub Textbox1_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Label1.Visible = True

End Sub
Private Sub Textbox2_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Label7.Visible = True

End Sub
Private Sub Textbox3_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Label4.Visible = True

End Sub
Private Sub Textbox4_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Label2.Visible = True

End Sub
Private Sub Textbox5_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Label5.Visible = True

End Sub
Private Sub Textbox6_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Label6.Visible = True

End Sub
Private Sub Textbox7_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Label3.Visible = True

End Sub
Private Sub label1_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Label1.Visible = False

End Sub
Private Sub label2_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Label2.Visible = False

End Sub
Private Sub label3_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Label3.Visible = False

End Sub
Private Sub label4_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Label4.Visible = False

End Sub
Private Sub label5_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Label5.Visible = False

End Sub
Private Sub label6_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Label6.Visible = False

End Sub
Private Sub label7_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Label7.Visible = False

End Sub
 
J

Jacob Skaria

Hi again

--What if you add one more label to a text box and make it visible in
MouseMove event of the control...Make sure you hide this in Userform mouse
move event

Private Sub Textbox1_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Label1.Visible = True
Me.Label11.Visible = True
End Sub

--Instead of this approach why dont you try the other approach suggested in
your previous post..ie; to have a frame and have all the controls insider the
frame. Display a permanent label outside the frame (within the same userform)
and instead of hiding the labek; change the display text when you move your
mouse from one control to another....


If this post helps click Yes
 
R

Rick Rothstein

This message is off-topic to this thread, so I apologize for that.

Jacob, I think you may have stopped following the thread with the subject
"Colorindex" (started on September 22nd), so I just wanted to direct your
attention back to it if you don't mind. I posted a follow up function that I
would appreciate your looking at and providing comments on if you have any.
Thank you.
 
J

Jacob Skaria

I am closely following that..and found a response this morning; but caught up
with some error (must be some minor issue..couldnt take a closer look). I am
gonna continue that thread anyway..thanks Rick

If this post helps click Yes
 
T

TotallyConfused

Thank you Jacob. This new request is for a different project similar to my
previous post. This one I need to add another label. I need to add another
label and only visible at the same time mouse is over text box. So both
labels will be visible only if mouse is over text box. Thank you for all
your help and expertise.
 
J

Jacob Skaria

Fine. So as mentioned in the below post; making the visible property of 2
labels within the control mouse move will help..

Private Sub Textbox1_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Me.Label1.Visible = True
Me.Label11.Visible = True
End Sub

If this post helps click Yes
 

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