Click here to Skip to main content
Click here to Skip to main content

Show cell value as tool tip for a Windows Form Grid

By , 23 Aug 2011
Rate this:
Please Sign up or sign in to vote.

To show a tool tip, add an event handler for the CellToolTipTextNeeded event and add the code below (depending on your requirement):

private void gridView1_CellToolTipTextNeeded(object sender, 
    DataGridViewCellToolTipTextNeededEventArgs e)
{
    if (e.ColumnIndex == 0)
        e.ToolTipText = "PrintPreview";
    else if (e.ColumnIndex == 1)
        e.ToolTipText = "Print";
    else if (e.ColumnIndex == 2)
        e.ToolTipText = "delete the file";
    else
        e.ToolTipText = string.Format("{0}", 
            gridView1.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
}

License

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

About the Author

b4usat

India India
No Biography provided

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Mobile
Web03 | 2.8.140415.2 | Last Updated 23 Aug 2011
Article Copyright 2011 by b4usat
Everything else Copyright © CodeProject, 1999-2014
Terms of Use
Layout: fixed | fluid