Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > DataGridView - Row Selector - Can they be numbered ???
 

DataGridView - Row Selector - Can they be numbered ???

Howdy all,

I have a datagridview and my data's index is NOT an integer; but I would like to see a number associated with the row.

Is there any way I can put a number in where the record selector goes?

I know what data i want in there - I just don't know how to put it there.

Is it possible ?

Thanks in advance for your help.


Randy
Randy_U  Friday, November 18, 2005 4:28 PM
Randy, you can display text in the row header cells. In C#, you would need to do this:
   this.dataGridView1.Rows[rowIndex].HeaderCell.Value = "text to show in header";
or
   this.dataGridView1.Rows[rowIndex].HeaderCell.Value = number.ToString();

Hope this is what you need.
Thanks,
-Regis
DataGridView developer

This posting is provided "as-is"
Regis Brid  Saturday, November 19, 2005 5:30 AM
Randy, you can display text in the row header cells. In C#, you would need to do this:
   this.dataGridView1.Rows[rowIndex].HeaderCell.Value = "text to show in header";
or
   this.dataGridView1.Rows[rowIndex].HeaderCell.Value = number.ToString();

Hope this is what you need.
Thanks,
-Regis
DataGridView developer

This posting is provided "as-is"
Regis Brid  Saturday, November 19, 2005 5:30 AM
Regis,

That's what I was looking for - Thanks. 

I was hoping there was a way just to set a boolean property or something - but hey I'll write the procedure and call it after the dgv is loaded and after every sort (add, delete).

Thanks again

Randy
Randy_U  Monday, November 21, 2005 1:37 PM

Hi,

Is it possible to hide the select icon on the rowheader cell ?

Thanks,

Reddy

Deva007  Tuesday, December 04, 2007 9:38 PM
Set the property RowHeadersVisible to false; also available at design time.
Manah Khalil  Saturday, August 08, 2009 10:28 PM

You can use google to search for other answers

Custom Search

More Threads

• Events for ComboBox thats inside a dataGridView .. plzzz help
• Access TableAdapter and TableAdapter Query for one DataGridView?
• Enabled HDR=yes in connection string but its still showing Header Information during load. Possible Select Statement problem
• How to use BindingSource.Filter to select Null fields
• Unbound DatagridView Sorting
• retrieving data from dataset tables and dispalying in listbox & removing plaese help me urgent
• Failed to load dataset because of the following error: Object reference not set to an instance of an object
• Adding non-text objects to a ListBox.... how ?
• Bindingnavigator and textboxes keep dissapearing :s
• Simple question on ComboBox Databinding look up.