views:

2159

answers:

3

I'm looking to add a tooltip to each row in a bound datagrid in vb.net winforms. How can this be done?

+1  A: 

I haven't tried this myself but I would give it a shot:

System.Windows.Forms.ToolTip formToolTip = new System.Windows.Forms.ToolTip();
formToolTip .SetToolTip(item, "Row Tooltip");

Where item corresponds to the cell you're setting the tool tip for.

Ricardo Villamil
A: 
row.cells[indexof].ToolTipText= "tootip here".

In winforms, it doesn't look like you can do the whole row.

if you NEED the whole row you can loop through the cells.

 foreach (DataGridViewCell cell in row.Cells)
                {
                    cell.ToolTipText = "tooltip here";
                }
Russ
A: 

ElseIf TypeOf control Is TabControl Then For Each control1 In control.Controls If TypeOf control1 Is TabPage Then strControlText = fnGetLanguage(control1.Text) End If For Each control2 In control1.Controls If TypeOf control2 Is Label Then strControlText = control2.Text ' strToolTipText = ToolTip.GetToolTip(control2) If strControlText.Contains("*") Then strDizi = Split(strControlText, " ") strControlText = fnGetLanguage(strDizi(0)) Else strControlText = fnGetLanguage(control2.Text) End If ElseIf TypeOf control2 Is DataGridView Then For i = 0 To control2.ColumnCount - 1 strControlText = control2.Columns(i).HeaderText strControlText = fnGetLanguage(strControlText) Next ElseIf TypeOf control2 Is ComboBox Then strControlText = control2.Text 'strToolTipText = ToolTip.GetToolTip(control2) If control2.DataSource Is Nothing Then For i = 0 To control2.Items.Count - 1 strControlText = control2.Items(i) strControlText = fnGetLanguage(strControlText) Next Else For i = 0 To control2.Items.Count - 1 strControlText = control2.Items(i).ToString strControlText = fnGetLanguage(strControlText) Next End If