2

How to give title in RowHeaders datagridview in VB.NET?

by that I mean circled the color in yellow in the screenshot below.

note : I use vb.net 2010 RowHeaders datagridview Thanks roy

Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398
roy
  • 693
  • 2
  • 11

1 Answers1

1

There's a property TopLeftHeaderCell for that cell. You can use it and set the Value for the cell:

DataGridView1.TopLeftHeaderCell.Value = "Index"

enter image description here

You can also set the other properties of the cell, like its alignment, for example:

DataGridView1.TopLeftHeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter
Reza Aghaei
  • 120,393
  • 18
  • 203
  • 398
  • Thanks. It went perfectly and can I set alignment "TopLeftHeaderCell.Value="Index"? – roy Dec 27 '21 at 03:05
  • @roy, yes you can set alignment or other properties of the cell like any other cell. I the example for setting alignment. See the bottom of the answer. – Reza Aghaei Dec 27 '21 at 09:13
  • It's going perfectly and you're indeed my master and teacher.I have another post maybe you can help "https://stackoverflow.com/questions/70491388/how-to-color-formborder-in-vb-net" – roy Dec 27 '21 at 09:34
  • one more how to give a notification comment to your name because I tried not to succeed – roy Dec 27 '21 at 09:52
  • Glad to hear that it helped! You can notify people by putting @ behind their name and usually the comment box shows an auto-complete context menu to choose the name. But when you comment under one of my posts, you do not necessarily need to notify me, I get the notification because it's my post. Also you cannot notify me in a thread that I'm not in, for example in a different question or answer that I've not done anything with that. – Reza Aghaei Dec 27 '21 at 10:02