NumericUpDown is a nice control... eh

on Wednesday, November 22, 2006

NumericUpDown Bug

From the site:

FAQs

NumericUpDown Print these FAQs
How do I get the Tooltips to be shown on a NumericUpDown control?

This is because of a bug in the .NET Framework. When tooltips are set on a control that hosts other controls within it (like the NumericUpDown), tooltips are not shown on those child controls. To workaround this issue, do the following in code:

[C#]

foreach ( Control c in numericUpDown1.Controls )
tooltip.SetToolTip( c, "mytooltip" );

[Visual Basic]

Dim c As Control
For Each c In numericUpDown1.Controls
tooltip.SetToolTip(c, "mytooltip")
Next

Contributed from George Shepherd's Windows Forms FAQ

2 comments:

Sarinah said...

hey...May i ask how to make the value at the numeric up down button set as default(which is zero)????

Whistler said...

Some problem present in this workaround.
When we move mouse from one child control to another then we have blinking and dancing of ToolTip. It happens because on hovering mouse on over child control new tooltip shown in new location with same text.