ComponentOne True DBGrid for .NET (2.0) Search HelpCentral 

C1TrueDBGrid.SelectedRows Property

Gets the collection of rows that are currently selected.

[Visual Basic]

Public ReadOnly Property SelectedRows As SelectedRowCollection

[C#]

public SelectedRowCollection SelectedRows {get;}

[Delphi]

public property SelectedRows: SelectedRowCollection read get_SelectedRows;

Example

The following code moves through table rows and selects any record that has the Country field set to Germany:

·      Visual Basic

       Dim row As Integer

       For row = 0 To Me.DsComposer.Composer.Rows.Count - 1

           If Me.DsComposer.Composer.Rows(row).Item("Country") = "Germany" Then

               Me.C1TrueDBGrid1.SelectedRows.Add(row)

           End If

       Next

·      C#

       int row;

       for (row = 0 ; row < this.DsComposer.Composer.Rows.Count; row ++)

       {

           if ( this.DsComposer.Composer.Rows[row].["Country"] == "Germany" )

           {

               this.c1TrueDBGrid1.SelectedRows.Add(row);

           }

       }

·      Delphi

       procedure TWinForm.button1_Click(sender: System.Object; e: System.EventArgs);

       var

         row: Integer;

       begin

         for row:= 0 to Self.DsComposer.Composer.Rows.Count - 1 do

         begin

           if (Self.DsComposer1.Composer.Rows[row].Item['Country'].ToString = 'Germany') then

             Self.C1TrueDBGrid1.SelectedRows.Add(row);

         end;

       end;

See Tutorial 5 - Selecting Multiple Rows Using Bookmarks to see this code used within an application.

See Also

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


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