E
eBob.com
Sorry about the cryptic Subject, it was the best I could do. But it does
describe my situation. I have a Controls.Add which works only if a MsgBox
is executed. Here's the code:
Sub HoverPopUp_SampleText(ByVal sender As SampleText)
MsgBox("popup entered") ' !! this is REQUIRED for the Controls.Add
below to work !!
Dim poploc As New Point(sender.LastMouseLoc.X + _
sender.rtbText.Location.X + sender.Location.X, _
sender.LastMouseLoc.Y + sender.rtbText.Location.Y + _
sender.Location.Y + 300)
sender.tbxHover.Location = poploc
'sender.tbxHover.Location = New Point(0, 0)
Me.Controls.Add(sender.tbxHover) ' !! doesn't work without MsgBox
above
sender.tbxHover.BringToFront()
End Sub
I have a SampleText class which consists of a RichTextBox and 6 buttons.
The class contains a MouseHover event handler for the RichTextBox. I'd like
the MouseHover event to popup a TextBox containing some information, but if
I did that in the SampleText class's MouseHover event handler it would have
to place the TextBox on the usercontrol which is not where I want it placed.
So, instead, the MouseHover event handler puts the information together in a
TextBox (tbxHover) and Raises the event which the code above handles. So
all the code above has to do is determine the location for the TextBox, do
the Controls.Add, and, for good measure, do a BringToFront.
With the MsgBox the code works as I'd expect. Without the MsgBox I never
see the TextBox (tbxHover)! Does anyone have any idea what could be going
on here?!?!?!?!
Thanks, Blob
describe my situation. I have a Controls.Add which works only if a MsgBox
is executed. Here's the code:
Sub HoverPopUp_SampleText(ByVal sender As SampleText)
MsgBox("popup entered") ' !! this is REQUIRED for the Controls.Add
below to work !!
Dim poploc As New Point(sender.LastMouseLoc.X + _
sender.rtbText.Location.X + sender.Location.X, _
sender.LastMouseLoc.Y + sender.rtbText.Location.Y + _
sender.Location.Y + 300)
sender.tbxHover.Location = poploc
'sender.tbxHover.Location = New Point(0, 0)
Me.Controls.Add(sender.tbxHover) ' !! doesn't work without MsgBox
above
sender.tbxHover.BringToFront()
End Sub
I have a SampleText class which consists of a RichTextBox and 6 buttons.
The class contains a MouseHover event handler for the RichTextBox. I'd like
the MouseHover event to popup a TextBox containing some information, but if
I did that in the SampleText class's MouseHover event handler it would have
to place the TextBox on the usercontrol which is not where I want it placed.
So, instead, the MouseHover event handler puts the information together in a
TextBox (tbxHover) and Raises the event which the code above handles. So
all the code above has to do is determine the location for the TextBox, do
the Controls.Add, and, for good measure, do a BringToFront.
With the MsgBox the code works as I'd expect. Without the MsgBox I never
see the TextBox (tbxHover)! Does anyone have any idea what could be going
on here?!?!?!?!
Thanks, Blob