Mercury.QTP.CustomServer Namespace > VerificationServerBase Class : GetTableData Method |
'Declaration
Protected MustOverride Function GetTableData() As System.Object(,)
protected abstract System.object[,] GetTableData()
Return Value
public class DataGridCPSrv : VerificationServerBase { /// <summary> /// Called by Quick Test to obtain grid content. /// The following base class properties are used: /// SourceControl - reference to Grid object /// FirstRow - the first (zero-based) row number /// LastRow - the last (zero-based) row number /// </summary> /// <returns> /// 2-dimensional array of objects. Each element is equal /// to the appropriate cell value /// </returns> protected override object[,] GetTableData() { DataGridView GridView = (DataGridView)(base.SourceControl); int TotalRows = GridView.Rows.Count; int TotalColumns = GridView.Columns.Count; int FirstRown = base.FirstRow; int LastRown = base.LastRow; TotalRows = LastRown - FirstRown + 1; object[,] Data = new object[TotalRows, TotalColumns]; DataGridViewRowCollection Rows = GridView.Rows; for (int i = FirstRown; i <= LastRown; i++) { DataGridViewRow Row = Rows[i]; DataGridViewCellCollection Cells = Row.Cells; for (int k = 0; k < TotalColumns; k++) { Data[i - FirstRown, k] = Cells[k].Value; } } return Data; }