Can we get A Name for the Row of DataGridView ...
-
Hi All ! Is it possible to Naming "Row" of A DataGridView as a Column "Header Text" . Thanks a Lot !
-
Hi All ! Is it possible to Naming "Row" of A DataGridView as a Column "Header Text" . Thanks a Lot !
I'm not sure what you mean, but how about System.Windows.Forms.DataGridViewRowHeaderCell.Value ?
-
I'm not sure what you mean, but how about System.Windows.Forms.DataGridViewRowHeaderCell.Value ?
yes , but Not For Rows , I don't think exist any property for Row to put a Text ! Thanks !
-
Hi All ! Is it possible to Naming "Row" of A DataGridView as a Column "Header Text" . Thanks a Lot !
How about you adding a DataGridViewColumn which would then hold the names you choose? :)
Luc Pattyn [My Articles] Nil Volentibus Arduum
-
yes , but Not For Rows , I don't think exist any property for Row to put a Text ! Thanks !
Then explain more clearly what you want.
System.Data.DataTable dt = new System.Data.DataTable() ; for ( int col = 0 ; col < 10 ; col++ ) { dt.Columns.Add ( new System.Data.DataColumn ( col.ToString() ) ) ; } for ( int row = 0 ; row < 10 ; row++ ) { System.Data.DataRow dr = dt.NewRow() ; for ( int col = 0 ; col < dt.Columns.Count ; col++ ) { dr \[ col \] = row \* col ; } dt.Rows.Add ( dr ) ; } this.dataGridView1.DataSource = dt ; for ( int row = 0 ; row < dt.Rows.Count ; row++ ) { **this.dataGridView1.Rows \[ row \].HeaderCell.Value = row.ToString() ;** }
This gives me a DataGridView showing a multiplication table with the row headers showing the row number.
-
Then explain more clearly what you want.
System.Data.DataTable dt = new System.Data.DataTable() ; for ( int col = 0 ; col < 10 ; col++ ) { dt.Columns.Add ( new System.Data.DataColumn ( col.ToString() ) ) ; } for ( int row = 0 ; row < 10 ; row++ ) { System.Data.DataRow dr = dt.NewRow() ; for ( int col = 0 ; col < dt.Columns.Count ; col++ ) { dr \[ col \] = row \* col ; } dt.Rows.Add ( dr ) ; } this.dataGridView1.DataSource = dt ; for ( int row = 0 ; row < dt.Rows.Count ; row++ ) { **this.dataGridView1.Rows \[ row \].HeaderCell.Value = row.ToString() ;** }
This gives me a DataGridView showing a multiplication table with the row headers showing the row number.
thanks for Ur Help , I wanted To give A Name for Each Row , that stored in a Combo Box !