Gets or sets index of the selected row.
[Visual Basic] Public Property SelectedIndex As Integer [C#] public int SelectedIndex {get; set;} [C++] public: __property int get_SelectedIndex(); public: __property void set_SelectedIndex(int); [JScript] public function get SelectedIndex() : int; public function set SelectedIndex(int);
The zero-based index of the selected row.
Exception Type | Condition |
---|---|
Exception | There is no ListManager. |
The SelectedIndex property allows you to iterate through a parent table's rows even if you are viewing the child table rows. For example, if you are viewing a child table, incrementing the SelectedIndex will cause the DataGrid to display the next set of records in the child table that are linked to the parent table.
The following example increments the SelectedIndex by 1.
[Visual Basic]
' Undone: check to make sure the index isn't at the end. DataGrid1.SelectedIndex += 1
DataGrid Class | DataGrid Members | System.WinForms Namespace