469,270 Members | 1,779 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,270 developers. It's quick & easy.

How can I place text in the rowheader column of my DataGridView in C#

Hi Team,

This is saravanan i am new to C#.. I am using VS2005 for my windows
based application.. I am using DataGridView to show the values.. What i
want is i want to display the text in the rowheaders of the
DataGridview and I want to enable the tooltip in the cells.

Thanks in advance

Any help or suggesstion is appreciated

Mar 15 '06 #1
1 4795
Hello,

I dont think your suppose to be able to change the RowHeader text in a
windows form, its quite simple in asp.net but in a windows form it can be a
pain in the behind.

However you could trying the following code.

private void MyDataGridView_RowPostPaint(object sender,
DataGridViewRowPostPaintEventArgs e)
{
// The using statement automatically disposes the brush.
using (SolidBrush b = new
SolidBrush(MyDataGridView.RowHeadersDefaultCellSty le.ForeColor))
{
e.Graphics.DrawString(e.RowIndex.ToString(),
e.InheritedRowStyle.Font, b, e.RowBounds.Location.X + 20,
e.RowBounds.Location.Y + 4);
}
}

Hope this helps in some way
Regards
Scott Blood
C# Developer

<sa***************@yahoo.com> wrote in message
news:11**********************@e56g2000cwe.googlegr oups.com...
Hi Team,

This is saravanan i am new to C#.. I am using VS2005 for my windows
based application.. I am using DataGridView to show the values.. What i
want is i want to display the text in the rowheaders of the
DataGridview and I want to enable the tooltip in the cells.

Thanks in advance

Any help or suggesstion is appreciated

Mar 15 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Griff | last post: by
1 post views Thread by Tim Newton | last post: by
10 posts views Thread by MSNews | last post: by
2 posts views Thread by Steve Richter | last post: by
6 posts views Thread by Miro | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.