Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/271.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何从c1FlexGrid获取特定值?_C#_C1flexgrid - Fatal编程技术网

C# 如何从c1FlexGrid获取特定值?

C# 如何从c1FlexGrid获取特定值?,c#,c1flexgrid,C#,C1flexgrid,我的WF上有7列10行的c1FlexGrid。双击后,我想打开另一个WF,它类似于该行的详细信息,但我想向该表单发送userId值。我不知道如何获取该id。我的代码如下所示: private void c1FlexGrid1_DoubleClick(object sender, System.EventArgs e) { int rowIndex = c1FlexGrid1.Row; if (rowIndex != -1) { int userId = I n

我的WF上有7列10行的c1FlexGrid。双击后,我想打开另一个WF,它类似于该行的详细信息,但我想向该表单发送userId值。我不知道如何获取该id。我的代码如下所示:

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();
  }      
}
有什么建议吗?

试试这个(
对象GetData(int-rowIndex,string-columnName)
):

其中,
RowSel
是所选行的索引

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