473,395 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

ToolTip over a DataGridView row?

I have a standard VC# 2005 DataGridView showing a group of records
coming from a table. Currently I have a CellMouseDoubleClick event
popping up a MessageBox which pulls a timestamp of the transaction
from a related table based on the row in the DataGridView that the
double click was registered against. I didn't want to add the extra
column with this timestamp info into the DataGridView since it's not
always needed by the enduser.

Rather than this double click mechanism I would like the ability to
create a mouse over event that would present this timestamp in a
bubble to the enduser. If they hover the mouse over a cell then that
row is fed into the method I have that presents the timestamp.
Checking out the ToolTip control it appears as if I can just define
the text to be presented if the enduser hovers their mouse over the
column headings. Not the cell contents themselves.

Am I missing something here? Even a basic example would be
appreciated, since I'm not looking to define the text explicitly in a
control property. I need to programmatically define it by passing the
DataGridView row's values into a method.

Thanks!

Apr 20 '07 #1
4 40713
On Apr 20, 9:19 am, gregarican <greg.kuj...@gmail.comwrote:
I have a standard VC# 2005 DataGridView showing a group of records
coming from a table. Currently I have a CellMouseDoubleClick event
popping up a MessageBox which pulls a timestamp of the transaction
from a related table based on the row in the DataGridView that the
double click was registered against. I didn't want to add the extra
column with this timestamp info into the DataGridView since it's not
always needed by the enduser.

Rather than this double click mechanism I would like the ability to
create a mouse over event that would present this timestamp in a
bubble to the enduser. If they hover the mouse over a cell then that
row is fed into the method I have that presents the timestamp.
Checking out the ToolTip control it appears as if I can just define
the text to be presented if the enduser hovers their mouse over the
column headings. Not the cell contents themselves.

Am I missing something here? Even a basic example would be
appreciated, since I'm not looking to define the text explicitly in a
control property. I need to programmatically define it by passing the
DataGridView row's values into a method.

Thanks!
Please disregard. I googled some more through the group postings and
found my answer!

Apr 20 '07 #2
Care to show your link to the answer so others might benefit? =)
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"gregarican" <gr*********@gmail.comwrote in message
news:11**********************@n76g2000hsh.googlegr oups.com...
On Apr 20, 9:19 am, gregarican <greg.kuj...@gmail.comwrote:
>I have a standard VC# 2005 DataGridView showing a group of records
coming from a table. Currently I have a CellMouseDoubleClick event
popping up a MessageBox which pulls a timestamp of the transaction
from a related table based on the row in the DataGridView that the
double click was registered against. I didn't want to add the extra
column with this timestamp info into the DataGridView since it's not
always needed by the enduser.

Rather than this double click mechanism I would like the ability to
create a mouse over event that would present this timestamp in a
bubble to the enduser. If they hover the mouse over a cell then that
row is fed into the method I have that presents the timestamp.
Checking out the ToolTip control it appears as if I can just define
the text to be presented if the enduser hovers their mouse over the
column headings. Not the cell contents themselves.

Am I missing something here? Even a basic example would be
appreciated, since I'm not looking to define the text explicitly in a
control property. I need to programmatically define it by passing the
DataGridView row's values into a method.

Thanks!

Please disregard. I googled some more through the group postings and
found my answer!

Apr 20 '07 #3
For a Windows Forms DataGridView, you can handle the
dataGridView1.CellToolTipTextNeeded event and dynamically provide the
tip text there.

dataGridView1.CellToolTipTextNeeded += new
DataGridViewCellToolTipTextNeededEventHandler(data GridView1_CellToolTipTextNeeded);
void dataGridView1_CellToolTipTextNeeded(object sender,
DataGridViewCellToolTipTextNeededEventArgs e)
{
e.ToolTipText = string.Format("tip for row {0}, col {1}",
e.RowIndex, e.ColumnIndex);
}

========================
Clay Burch
Syncfusion, Inc.

Apr 20 '07 #4
On Apr 20, 11:18 am, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
Care to show your link to the answer so others might benefit? =)

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"gregarican" <greg.kuj...@gmail.comwrote in message

news:11**********************@n76g2000hsh.googlegr oups.com...
On Apr 20, 9:19 am, gregarican <greg.kuj...@gmail.comwrote:
I have a standard VC# 2005 DataGridView showing a group of records
coming from a table. Currently I have a CellMouseDoubleClick event
popping up a MessageBox which pulls a timestamp of the transaction
from a related table based on the row in the DataGridView that the
double click was registered against. I didn't want to add the extra
column with this timestamp info into the DataGridView since it's not
always needed by the enduser.
Rather than this double click mechanism I would like the ability to
create a mouse over event that would present this timestamp in a
bubble to the enduser. If they hover the mouse over a cell then that
row is fed into the method I have that presents the timestamp.
Checking out the ToolTip control it appears as if I can just define
the text to be presented if the enduser hovers their mouse over the
column headings. Not the cell contents themselves.
Am I missing something here? Even a basic example would be
appreciated, since I'm not looking to define the text explicitly in a
control property. I need to programmatically define it by passing the
DataGridView row's values into a method.
Thanks!
Please disregard. I googled some more through the group postings and
found my answer!- Hide quoted text -

- Show quoted text -
What I did was set the ShowCellToolTips DataGridView property to False
in the design view. By default it's set to True. Then I went in and
defined the CellMouseEnter event for the DataGridView. Here's a
snippet, where dgv_Lookup is a DataGridView instance, and ttLookup is
a ToolTip instance:

dgvLookup_CellMouseEnter(object sender, DataGridViewCellEventArgs e)
{
// Ignore any mouse hovers other than those at column 7.
Also ignore any invalid RowIndex values.
if (e.RowIndex != -1 && e.ColumnIndex == 7)
{
DataTable showTable = new DataTable();
DataRow showRow;
showRow = showTable.NewRow();
dsTableAdapters.taTrxTableAdapter taTrxTable = new
dsTableAdapters.taTrxTableAdapter();
showTable =
taTrxTable.GetDataById(this.dgvLookup.Rows[e.RowIndex].Cells[0].Value.ToString());

// Just fetch the first row of the result set.
showRow = showTable.Rows[0];
this.dgvLookup.CurrentCell.ToolTipText =
showRow["loggedTime"].ToString();

this.ttLookup.Show(showRow["loggedTime"].ToString(), this.dgvLookup);
}
}

Apr 20 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: soum | last post by:
Hello, How do you format a tooltip (eg. make the text bold/italic/underline)? Specifically, I want to format the tooltip that shows up when you mouseover the column header in a DataGridView. I get...
2
by: Rich | last post by:
Hello, Some database applicatins have a tooltip feature where when you are dragging the scrollbar of the table view a tooltip appears next to the mouse cursor displaying the approximate record...
5
by: Kathy | last post by:
I am trying to set a tooltip for a column cell in a data grid as documented in the MS Visual Studio 2005 documentation. I set up a test to match the example exactly including database column, data...
4
by: Pieter | last post by:
Hi, Using VB.NET 2.0, Windows Forms. I want the ToolTip to be shown on every TextBox, ComboBox and DataGridView continuously, and show the contence of these controls. Is there a way to add the...
0
by: giddy | last post by:
hi , i want to be able to add a tooltip on a cell when the user makes a mistake. The cell in my app turns red if the user enters somehting wrong. but i want to alert the user and tell him what...
0
by: windy | last post by:
Hi all, how can i add tooltip for columnheader on datagridview? Thanks.
3
by: Eran.Yasso | last post by:
Hi, I need to display some info attached to a row in Datagridview. I thought to do it in MouseMove event. The problem is that this event is continuously fired which causes the tooltip to...
3
by: Richard Lewis Haggard | last post by:
I have a DataGridView which has a cell that is going to contain what might be a large amount of text data. The UI designed has decreed that each row will have a button that toggles the row's...
0
by: Dharmaraju | last post by:
In VB.net ====== I have datagridview and tooltip control . I want to attach the tooltip control with datagridview row . when the user move from one row to another row the tooltip...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.