C# 光标如何定位到gridControl指定的行和列?
主要功能代码如下:
/// <summary>
/// 根据列来选中一行
/// </summary>
/// <param name="gridView">GridView</param>
/// <param name="colName">列名称</param>
/// <param name="colValue">列值</param>
public static void SelectRow(this GridView gridView, string colName, object colValue)
{
gridView.ClearSelection();
for (int rowHandle = 0; rowHandle < gridView.RowCount; rowHandle++)
{
object _cellValue = gridView.GetRowCellValue(rowHandle, colName);
if (_cellValue != null)
{
if (_cellValue == colValue)
{
gridView.SelectRow(rowHandle);
break; } } }}
代码示例如下:
gcLampConfig.UIThread<GridControl>(gc => gvLampConfig.SelectRow(gcKeyFieldN