Please note: In an effort to better serve you, we are in the process of restructuring DevCenter. In the process, we have moved many items that you may be used to finding in DevCenter over to the Main Site. If you are having trouble locating something, please try looking at the following places:
The UltraWinGrid generally has an Active Row, which is a reference to a single row in any of the bands. Visually the Active Row is identified by a triangle pointing to the right. The developer has direct access to the Active Row with the .ActiveRow property of an instance of the UltraWinGrid.
QuestionsHow to tell if there is an ActiveRow? How to change the ActiveRow through code? What events fire when the ActiveRow changes? SolutionsActiveRow will be equal Nothing if there is no active row.The developer can set ActiveRow to an instance of an UltraWinGrid Row object.When ActiveRow changes the following events fire:BeforeRowDeactivate BeforeRowActivate AfterRowActivate
This project illustrates when Row Selection is performed and how to interact with the ActiveRow property of the grid.This project consists of the following classes:clsCustomerData - provides a method for creating the Customers DataTable. This Class is not reviewed.clsCustOrderData - provides a method for creating the Customer Orders DataSet. This Class is not reviewed.clsOrderData - provides a method for creating the Orders DataTable. This Class is not reviewed.Form1 - contains the code relevant to this project and consists of the following relevant code Regions:Form EventsFormLoad - contains the code used to initialize the event viewer TextBox, create the Customer Orders DataSet and bind it to the UltraWinGrid:
UltraWinGrid EventsInitializeLayout - contains the code used to initialize the grid layout:
AfterRowActivate - event adds an entry to the Event Viewer:
BeforeRowDeActivate - event adds an entry to the Event Viewer:
BeforeRowActivate - event adds an entry to the Event Viewer:
MouseDown - event adds an entry to the Event Viewer:
KeyDown - event adds an entry to the Event Viewer if the key pressed is not the Alt key. The Alt key is swallowed by this event so the state of the display does not change when pressing 'Alt-PrintScreen' to capture a screen shot:
MouseUp - event adds an entry to the Event Viewer, then attempts to retrieve and display the value of the cell on which the event occurred:
Button EventsThe Button Events demonstrate two different ways to pass rows in the UltraWinGrid in search of one specific rowSet Active Row to CustomerID=2 - passes the rows of Band 0 looking for a row with the “CustomerID” column value = 2. If the project does not use Group By, then the UltraGrid.Rows collection can be used to pass all of the rows in Band 0:
Set Active Row to CustomerID=2, OrderID=4 - passes all of the rows in all of the bands looking for a band 1 record with a CustomerID = 2 and an OrderID = 4. This code is interesting in that it passes all of the bands and rows of the hierarchical grid:
ReviewThis is a very interesting project in that it reviews many different ways to interact with the .ActiveRow of the grid. There are three extremely relevant code sections:The MouseUp event code used to determine if a cell was under the MouseUp and displaying the value of cells with various DataTypes. The Set Active Row to CustomerID=2 event code used to pass all of the rows in band 0. The Set Active Row to CustomerID=2, OrderID=4 event code used to pass all of the rows in an hierarchical grid.