2017-10-04 87 views
0

我的c1FlexGrid在我的WF上有7列和10行。双击我想打开另一个WF,就像该行的细节,但我想发送userId值到该窗体。我不知道如何得到这个ID。我的代码如下所示:如何从c1FlexGrid获取特定值?

private void c1FlexGrid1_DoubleClick(object sender, System.EventArgs e) 
{ 
    int rowIndex = c1FlexGrid1.Row; 
    if (rowIndex != -1) 
    {   
    int userId = I need value from column "UserId" on this rowIndex. 
    frmUser userForm = new frmUser(userId); 
    userForm.ShowDialog(); 
    }  
} 

任何建议?

回答

1

试试这个(object GetData(int rowIndex, string columnName)):

int userId = (int)c1FlexGrid1.GetData(c1FlexGrid1.RowSel, "UserId"); 

哪里RowSel是选定行的索引。