Visual Basic: DataGrid Control
Returns the ColIndex value of the DataGrid control column containing the specified coordinate (X) value. Doesn't support named arguments.
The ColContaining method syntax has these parts:
|object||An object expression that evaluates to an object in the Applies To list.|
|coordinate||Required. A single numeric expression that defines a horizontal coordinate (X value) based on the coordinate system of the container.|
The ColContaining method returns a number that corresponds to one of the column indexes of the control specified by object. This number ranges from 0 to 1 less than the setting of the Count property of the Columns collection (0 to Columns.Count - 1). This method is useful when working with mouse and drag events when you are trying to determine where the user clicked or dropped another control in terms of a column of the DataGrid control.
If coordinate is outside of the coordinate system of the container, a trappable error occurs.
Note The ColContaining method returns the ColIndex of the column indicated, not the visible column. If coordinate falls in the first visible column, but two columns have been scrolled off the left side of the control, the ColContaining method returns 2.