C# WinForms: Trouble getting tooltip near mouse coordinate

I have a DataGridView and need to show a tool tip at the cursor displaying the full contents of the entire row.  But this call seems to fail:

            this.addSpecialtyToolTip.Show("Test tip", myDataGridView, 0, 0);

However, this one works:

            this.addSpecialtyToolTip.Show("Test tip", myOkButton, 0, 0);


But I do not want the tool tip over the OK button.

I did not the DataGridView has a bool property "ShowCellToolTips", but when I call

myDataGridView.ShowCellToolTips = true, nothing displays.

Any ideas what I am missing?
newbiewebSr. Software EngineerAsked:
Who is Participating?
 
Robert SchuttConnect With a Mentor Software EngineerCommented:
If you have ShowCellToolTips = true, then an 'internal' tooltip is shown when a cell value is too long to display. Set it to false and you can set individual tooltips like this:
this.myDataGridView.Rows[0].Cells[0].ToolTipText = "Test tip cell";

Open in new window

0
 
Robert SchuttConnect With a Mentor Software EngineerCommented:
Sorry, got that mixed up, ShowCellToolTips = true shows cell tooltips (duh). But by default will only show the full value if it's too long to show in the cell as it is. So use the cell tooltip for that. Otherwise, to use your own tooltip, you need to set ShowCellToolTips = false.
0
 
newbiewebSr. Software EngineerAuthor Commented:
Mine will always be lober than an individual cell's width.  But your code does not work.  I did the following:

myDataGridView.ShowCellToolTips = true;
myDataGridView.Rows[0].Cells[0].ToolTipText = "Test cell tip";

What am I missing?
0
 
newbiewebSr. Software EngineerAuthor Commented:
Got it working as you described.  Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.