Home - Forums-.NET - FlyGrid.Net (Windows Forms) - Simple text row...

FlyGrid.Net (Windows Forms)

.NET Datagrid - Fast, highly customizable, industry standards .NET data grid control for WinForms

This forum related to following products: FlyGrid.Net

Simple text row...
Link Posted: 03-Aug-2005 01:39
What I want to be able to do is add simple text rows to my flygrid, I have two columns already added with the designer. Below is a simple example to illistrate what I would like to acheive. I do not want the data in the rows to be editable
i.e.


dim i as integer
dim column1 as string
dim coumn2 as string
' myArray has 10 values added therefore should expect to see 10 rows in my flygrid
for i = 0 to myArray.count - 1
  column1 = myArray(i) & "1"
  column2 = myArray(i) & "2"
  'add text row here with correct syntax
  me.flygrid1.row.add(column1,column2)
next i


Thanks inadvance

Simon
Link Posted: 03-Aug-2005 06:51
There is two ways to easily add rows:
1. Create 2-dimensional data array of data and connect to FlyGrid.Rows.DataSource:

[VB.Net]
Dim gridData As System.Object()() = New System.Object()() { _
          New String() {"Mike Carter", "First administrator"}, _
          New String() {"Leo Scott", "Main forum moderator"}, _
          New String() {"Kim Manner", "Second forum moderator"}, _
          New String() {"Gerhardt Simmons", "Technical engineer"} _
      }

flyGrid.BeginInit()
Try
  'Add columns
  For i=0 To 2
    flyGrid.Columns.Items.Add(New Column(i.ToString()))
  Next i
  'connect to Data source
  flyGrid.Rows.DataSource = gridData
Finally
  flyGrid.EndInit()
End Try


2. Or add nodes:
[VB.Net]
flyGrid.BeginInit()
Try
  'Add columns
  For i=0 To 2
    flyGrid.Columns.Items.Add(New Column(i.ToString()))
  Next i
  'connect to Data source
   For i=0 To 10
    Dim data as Object() = new Object(){"Cell[Row"+i + "Col0", "Cell[Row"+i + "Col1"}
    flyGrid.Rows.Items.Add(New Node(data))
  Next i
Finally
  flyGrid.EndInit()
End Try