Tool Tip for CheckedListBox in Windows Form

Posted by Naraayanan under C# on 8/6/2013 | Points: 10 | Views : 5162 | Status : [Member] | Replies : 2
Hi All,
How can i use ToolTip in CheckedListBox in the Win Form (VS 2008). CheckedListBox data is bound (fetch from Database).

Regards,
Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
http://abaprocker.blogspot.com/



Responses

Posted by: Jeyanthi on: 8/7/2013 [Member] Starter | Points: 25

Up
0
Down
Hi,

Try the following code in MouseMove event of the CheckedListBox

Dim toolTip1 As New System.Windows.Forms.ToolTip


Private Sub CheckedListBox1_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles CheckedListBox1.MouseMove
Dim pos As Point = CheckedListBox1.PointToClient(MousePosition)
Dim index As Integer = CheckedListBox1.IndexFromPoint(pos)

If (index > -1) Then
toolTip1.SetToolTip(CheckedListBox1, CheckedListBox1.Items(index).ToString)
End If
End Sub

Regards,
Jeyanthi

Naraayanan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Ssj_Kumar on: 8/8/2013 [Member] Starter | Points: 25

Up
0
Down
Try the below code, Change the code if your binding logic differ
DataTable c = new DataTable();
checkBoxColumns.DataSource = c;
checkBoxColumns.DataTextField = "Name";
checkBoxColumns.DataValueField = "column_name";
checkBoxColumns.DataBind();

foreach (DataRow row in c.Rows)
{
checkBoxColumns.Items[i].Attributes.Add("ToolTip", row.Cells[2].Text);
checkBoxColumns.ToolTip = row.Cells[2].Text;
i++;
}

Regards,
Jayakumar Selvakani

Naraayanan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response