CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2011
    Posts
    9

    Red face Add ToolTips to Individual Cells in DataGrid

    Hye. I have this form that has datagrid in it. The datagrid's values are retrieved from a database. Since the value for certain cells are too long, so, we can only see half of the full cell value.

    Other than enabling the scroll bar on the datagrid, I want to add another feature which is the tooltip to allow us to see the whole value of the cell. The tooltip will display the full value of the cell where the cursor touches on.

    Can somebody help me?

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Add ToolTips to Individual Cells in DataGrid

    I have never heard of the tooltip being available on cells of a datagrid, though I suppose it is possible I doubt that it is there.
    You could in theory mimic one by using a floating label that will pop up in a given location based on the mouse position.
    Always use [code][/code] tags when posting code.

  3. #3
    Join Date
    Jul 2011
    Posts
    9

    Re: Add ToolTips to Individual Cells in DataGrid

    Owh really? I saw the tooltip feature in the datagrid properties, so thought i can add tooltip on the datagrid.

    by the way, thank you for your suggestion. I will think of it.

  4. #4
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: Add ToolTips to Individual Cells in DataGrid

    You can add a tooltip to the datagrid but to the best of my knowledge you can add only one and not one per cell. However it may be possible to change the contents of ToolTip based on mouse position within the grid.
    Always use [code][/code] tags when posting code.

  5. #5
    Join Date
    Jul 2011
    Posts
    9

    Re: Add ToolTips to Individual Cells in DataGrid

    Is it possible? But what if the data in the table changes? The tooltip will remain displaying the same value right? I mean it displays the value before changes on the database are made.

    Sorry for keep asking. =)

  6. #6
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: Add ToolTips to Individual Cells in DataGrid

    You can use the Datagrids mousemove event to find out where on the grid to pointer is, and sett the tooltip accordingly...

    If the data has changed the event should still update the tooltip with the new info....
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured