DataGrid传值定位选中行

 string InputStr = strVipID;
            foreach (DataGridViewRow dvr in dbgVip.Rows)
            {
                if (dvr.Cells[0].Value.ToString().StartsWith(InputStr))
                {
                    dbgVip.ClearSelection();
                    dvr.Selected = true;
                    break;
                }
            }

你可能感兴趣的:(datagrid)