CGXBrowserGrid::GetFieldFromCol

short GetFieldFromCol(ROWCOL nCol);

nCol

Specifies the column id.

Return Value

A zero-based short index.

Remarks

Returns the zero-based field index associated with a column. GetFieldFromCol calls GetColIndex and converts the column id to a zero-based field index.

If you override OnLoadCellStyle (or any other methods where you connect the grid to your data source), you should always take care to dereference the index associated with a column. This enables your application to support rearranging columns.

Example

This sample code shows you how you can use this method to dereference the original field associated with a column:

   // determine field index for the column
   short nField = GetFieldFromCol(nCol);
   // now, I can determine field information
   CField* fld = GetDocument()->m_dbfile.GetField(nField);

See Also

 CGXBrowserGrid::GetColIndex  CGXBrowserGrid::OnLoadCellStyle

CGXBrowserGrid

 Class Overview |  Class Members