=?Utf-8?B?Unlhbg==?= <Ry**@discussions.microsoft.comwrote in
news:6C**********************************@microsof t.com:
I have a winform with 20 text boxes; some text boxes have default
values and some are blank. I have the following code to display
ToolTip for each of the TextBox controls:
System.Windows.Forms.ToolTip ToolTip1 = new
System.Windows.Forms.ToolTip();
foreach (Control ctrl in this.Controls)
{
if (ctrl is TextBox)
{
ToolTip1.SetToolTip(ctrl, ctrl.Text);
}
}
When I change data or add data to a blank textbox control; the ToolTip
will not display updated information.
How do I resolve this issue?
Without asking the obvious question of "Why set the tooltip text to the
control text" you probably need to capture the event when the user is
changing the text in the box... The code above only sets the tooltip to
what it is at the time the code runs - it doesn't mean to make the tooltip
whatever is in the control when the tooltip appears. Try capturing the
keypressed event or something like that, and then re-set the tooltip. You
might also need to append the character being typed?
-mdb