Working With Microsoft DataGridView

Applies to TestComplete 14.70, last modified on April 22, 2021

TestComplete has the Microsoft Control Support plugin that expands TestComplete abilities to interact with Microsoft DataGridView controls from scripts. If this plugin is installed and enabled, TestComplete extends the DataGridView control functionality with methods, properties and actions of the MicrosoftDataGridView object. These supplementary members let you perform specific operations over the DataGridView control, for example, simulate clicks on grid cells, obtains and set values in grid cells, click column headers and so on.

Since the DataGridView is a .NET control and can be used within .NET applications, which are always “open” to TestComplete, the internal methods and properties of the DataGridView control are also visible to TestComplete. This “openness” means that you can use the DataGridView’s “native” methods and properties to perform the needed actions as well.

Finally, you can work with the DataGridView control as a black-box application window, that is, you can simulate various mouse actions and keystrokes, record and play back low-level procedures, and so on. For more information, see Simulating User Actions.

In order for TestComplete to have access to internal methods and properties of the DataGridView control and to extend the DataGridView control functionality, both the .NET Application Support and Microsoft Control Support plugins must be installed and enabled.

The topics of this section provide detailed information about performing various operations with the DataGridView control. They also contain numerous sample routines that you can use in your scripts with minimum changes (if any). Note, that these topics are devoted to DataGridView controls of the .NET Framework. For information on working with DataGrid controls, see the Working With Microsoft DataGrid section.

In This Section

Searching for Records in Microsoft DataGridView

Describes how to search for a specific record within the DataGridView control.

Selecting Cells in Microsoft DataGridView

Describes the approaches used to select individual grid cells.

Getting the Focused Row, Column and Cell in Microsoft DataGridView

Explains how to determine the row, column and cell that is currently focused.

Activating and Closing In-place Editors in Microsoft DataGridView

Explains how you can activate the cell’s edit mode and save changes made to the cell value.

Obtaining and Setting Cell Values in Microsoft DataGridView

Describes how you can get and set values in individual grid cells.

Working With Specific In-place Editors in Microsoft DataGridView

Explains how you can set values in the check box and combo box editors.

Copying and Pasting Cell Values in Microsoft DataGridView

Describes how you can copy or paste the cell value.

Selecting Multiple Records in Microsoft DataGridView

Describes how you can select several rows, columns and cells within the DataGridView control.

Obtaining Selected Records in Microsoft DataGridView

Explains how to obtain the records selected in the DataGridView control.

Iterating Through Rows in Microsoft DataGridView

Describes how to process the grid rows data in a loop.

Sorting Data in Microsoft DataGridView

Explains how you can sort data displayed in the DataGridView control.

Related Topics of Interest

Table Checkpoints

Explains how to create checkpoints that verify data displayed in tabular controls.

Samples

TestComplete includes a sample project that demonstrates how you can work with Microsoft DataGridView controls from scripts:

<TestComplete Samples>\Desktop\Working With Grids\Microsoft DataGridView

Note: If you do not have the sample, download the TestComplete Samples installation package from the support.smartbear.com/downloads/testcomplete/samples/ page of our website and run it.

This script requires the sample application that is shipped along with the script and by default has the following path within the project suite folder: \DataGridViewSample\bin\Release\DataGridViewSample.exe. Before running the script, make sure that the TestComplete Tested Applications project item contains a valid link to the application to be tested (DataGridViewSample.exe).

See Also

Microsoft DataGridView Support
Working With Grids
Supported Microsoft Controls
Requirements for Testing .NET Applications

Highlight search results