FlexGrid for WinForms Task-Based Help > Populating an Unbound Grid with Data > Populating a Column with Data |
To populate a column with data when the form loads, set a loop with the grid's indexer to the data to fill the column. Add the following code to the Form_Load event to set column one to zero:
To write code in Visual Basic
Visual Basic |
Copy Code
|
---|---|
Dim r As Integer For r = C1FlexGrid1.Rows.Fixed To C1FlexGrid1.Rows.Count - 1 Me.C1FlexGrid1(r, 1) = 0 Next |
To write code in C#
C# |
Copy Code
|
---|---|
int r; for (r = c1FlexGrid1.Rows.Fixed; r <= c1FlexGrid1.Rows.Count -1;r++) { this.c1FlexGrid1[r, 1] = 0; } |
Column one fills with zeros.