Mech_Engineer
Mech_Engineer

Reputation: 555

TextBox string as tooltip on hover

I'm building an application and I have a TextBox control that is filled with a value. On some occasions the control is too small and I don't have the space to expand it.

How do you show the TextBox content on hover when the control is too small?

Upvotes: 2

Views: 6095

Answers (2)

slippy
slippy

Reputation: 21

Add a tooltip to the form and the following code

 Private Sub TextBox1_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.MouseHover
    ToolTip1.SetToolTip(TextBox1, TextBox1.Text)
End Sub

Upvotes: 2

Stefano d'Antonio
Stefano d'Antonio

Reputation: 6152

This has the same answer as this question: Showing Textbox ToolTip

Private _toolTip As New ToolTip()

Private Sub TextBox1_TextChanged(ByVal sender As Object, ByVal e As EventArgs) _
                                 Handles TextBox1.TextChanged
  _toolTip.Show(TextBox1.Text, TextBox1)
End Sub

Upvotes: 0

Related Questions