Reputation: 27
Picture:
I want my tooltip to show the text that is set in a textbox, how can I do this exactly? Yes I know the Tooltip property but textbox.Text does not work, I just want to show textbox text in tooltip (dynamic).
Thanks for your help
Upvotes: 2
Views: 1593
Reputation: 2974
if you want to change the Tooltip each time the TextBoxText has changed you can put the SetToolTip()
Function into the OnTextChanged()
Callback.
ToolTip toolTip1 = new ToolTip();
public Form1() {
InitializeComponent();
toolTip1.ShowAlways = true;
toolTip1.ToolTipTitle = "TextBox Text";
toolTip1.SetToolTip(textBox1, textBox1.Text);
}
private void OnTextChanged(object sender, EventArgs e) {
toolTip1.SetToolTip(textBox1, textBox1.Text);
}
To add the TextChanged Event you need to open the TextBoxs Property page, click on the Thunderbolt and add the Function Name to the TextChanged Row.
Upvotes: 1