Click here to Skip to main content
15,302,656 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi,,
I have one gridview in my windows form. Now i'm showing custom tooltip using the following code,
C#
private void Audit_Dg_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
          if (e.ColumnIndex == 7 || e.ColumnIndex == 8 || e.ColumnIndex == 10 || e.ColumnIndex == 11 && e.RowIndex >= 0)
          {           
              DataGridViewCell cell = this.Audit_Dg.Rows[e.RowIndex].Cells[e.ColumnIndex];

              cell.ToolTipText = "Click Here To View The Message";


          }
}

it showing my message for those cells satisfying my condition and the cell content for all those doesn't satisfying my condition. is there any way to remove that tool-tips from my grid-view and show only my custom tool-tip?
if there any way,please help me...
Posted
Comments
Sergey Alexandrovich Kryukov 12-Oct-12 16:26pm
   
I don't understand what do you mean by "custom tooltip". Is it also cell.ToolTipText? Or some other way? Why cannot you simply change cell.ToolTipText? At what event to you want to change/enable/disable it?
--SA

1 solution

You have to add just a little code in you current code:
C#
private void Audit_Dg_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
 {
          if (e.ColumnIndex == 7 || e.ColumnIndex == 8 || e.ColumnIndex == 10 || e.ColumnIndex == 11 && e.RowIndex >= 0)
          {           
              DataGridViewCell cell = this.Audit_Dg.Rows[e.RowIndex].Cells[e.ColumnIndex];
 
              cell.ToolTipText = "Click Here To View The Message";
 

          }
         //Add this else condition in your code
          else
          {
            cell.ToolTipText = String.Empty;
          }
}
   
v2
Comments
ManjIndian 18-Oct-12 1:52am
   
its won't work.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900