How to get a cell text in a c1flexgrid

4k Views Asked by At

Can anybody help me?

I need to get a text from a cell in the c1flexgrid when I click it. I use this code:

private void CmdSaveCellContent_Executed(EventParameters param)
{
    C1FlexGrid dg = param.Sender as C1FlexGrid;
    Point mp = Mouse.GetPosition(dg);
    HitTestInfo hti = dg.HitTest(mp);
    if (hti.Column == -1 || hti.Row == -1 || dg.Rows.Count <= hti.Row) return;
    var celltext = dg.Cells[hti.Row, hti.Column];

...
}

It works if cell contains text information. But if cell contains Enum, visually I see text, but in the celltext variable I get int value ("0" or "2" for instance).

Sorry for my English

1

There are 1 best solutions below

0
On

Try using the following line of code in the AfterSelChange event of the C1Flexgrid :

MessageBox.Show(Me, "Value of cell " & Me.C1FlexGrid1.Row.ToString() & "/" & Me.C1FlexGrid1.Col.ToString() & ": " & Me.C1FlexGrid1(Me.C1FlexGrid1.Row, Me.C1FlexGrid1.Col).ToString())

Regards, Mohita