ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

C1TrueDBGrid.AddRows Method

Adds the number of given rows to an unbound grid.

[Visual Basic]

Overrides Public Function AddRows( _

ByVal count As Integer _

) As Integer

[C#]

override public int AddRows(

int count

);

[Delphi]

public function AddRows(

count: Int32

): Int32; override;

Parameters

count

The number of rows to add.

Return Value

The index of the first row that was added.

Example

The following code uses the AddRows method to add two empty rows to an unbound grid:

·      Visual Basic

       Dim index As Integer = Me.C1TrueDBGrid1.AddRows(2)

       Dim i As Integer

       For i = index To 1

           Me.C1TrueDBGrid1(i, "FirstName") = "Joe"

           Me.C1TrueDBGrid1(i, "LastName") = "Doe"

           Me.C1TrueDBGrid1(i, "DateOfBirth") = New DateTime(2000, 1, 15)

       Next i

·      C#

       int index = this.c1TrueDBGrid1.AddRows(2);

       for(int i=index; i < 2; i++)

       {

           this.c1TrueDBGrid1[i,"FirstName"] = "Joe";

           this.c1TrueDBGrid1[i, "LastName"] = "Doe";

           this.c1TrueDBGrid1[i, "DateOfBirth"] = new DateTime(2000,1, 15);

       }

·      Delphi

       var I, index : Integer;

       index := Self.C1TrueDBGrid1.AddRows(2);

       for i:= index to 1 do

       begin

         Self.C1TrueDBGrid1[i] := 'Joe';

         Self.C1TrueDBGrid1[i] := 'Doe';

         Self.C1TrueDBGrid1[i] := DateTime.Create(2000, 1, 15);

       end;

For more details on the AddRows method, see the Displaying Data without Binding to a DataSource topic.

See Also

C1TrueDBGrid Class | C1TrueDBGrid Members | C1.Win.C1TrueDBGrid Namespace


Send comments about this topic to ComponentOne.
Copyright © ComponentOne LLC. All rights reserved.