Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Programmatically set DateTimePicker Tooltip

I am trying to do the following, but it doesn't work:

MyDateTimePicker.ToolTipText = "test"; //Doesn't work

To be clear, I know how to add a tooltip to some control using the designer and how to change it's tooltip text programmatically but it doesn't seems to work for the DateTimePicker control. I don't understand since in the properties of the control in the designer I can see (and set) the ToolTip text.

This seems like a basic problem, but I can't find any information related to this.

like image 791
Maxter Avatar asked Feb 14 '26 03:02

Maxter


2 Answers

You can try something like that:

var yourToolTip = new ToolTip();
//The below are optional, of course,

yourToolTip.ToolTipIcon = ToolTipIcon.Info;
yourToolTip.IsBalloon = true;
yourToolTip.ShowAlways = true;

yourToolTip.SetToolTip(dateTimePicker1, "Oooh, you put your mouse over me.");
like image 67
Pankwood Avatar answered Feb 15 '26 15:02

Pankwood


There is no ToolTip property for the DateTimePicker.

You have to do the following:

ToolTip toolTip = new ToolTip();
toolTip.AutoPopDelay = 3000;
toolTip.ShowAlways = true;
toolTip.SetToolTip(dateTimePicker1, "Tool Tip for DateTimePicker");
like image 43
Sach Avatar answered Feb 15 '26 15:02

Sach



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!