this blog contains information for .net and sql stuffs. You can find various tips and tricks to overcome problem you may be facing in ...

Thursday, June 25, 2009

Show tooltip on Windows Controls..

It has been happen that we have some value in text box and dropdown box but we have not that much of space to show all text resides in it.

In those situation we can show whole text by tooltip. We all are familiar with tool tip. In windows operating system when you are going to click on some folder or just move your cursor on it. you would get info of that item.

you can use this in your application too..

.Net provides ToolTip control. with it use you can do that in very less time quickly.

Steps are as follows.

1) Add ToolTip control to your form (just drag from Tool box)

2) Now choose on which control you want to see tool tip.(Either text box,Radio button any controls you have on your form)

3)Go to the events of your control.

Now you have two events MouseHover and MouseMove.

MouseHover -It will be fired when your cursor resides to control for some amount of time.

MouseMove-It always fire when your cursor moving on control.

In that event write as..

ToolTip.SetToolTip(yourcontrolname,"Text you want to display")

ToolTip.Active = True

This will show "Text you want to dispaly" Tooltip when you move your cursor to that control. You don't need to create as many tool tip as all controls on which you want to show.

This one tool tip will do all for you. You just need to set control and tooltip text on the event of control.

No comments: