StrataFrame Forum

Using Thread read data of the gridView1 ?

http://forum.strataframe.net/Topic33375.aspx

By Dong Trien Lam - 8/24/2016

I'm writing code read data of gridView1 has got using Thread but get an error:

// old-style writing
if (string.IsNullOrEmpty(gridView1.GetRowCellValue(i, "Ghichu").ToString()))

//new style writing                        
if (string.IsNullOrEmpty(GetGridCellValue(i, "Ghichu").ToString()))

//Declare complement the new style writing
public delegate void GridGetEventArg(int rowHandle, string fieldname);
private string GetGridCellValue(int row, string fieldname)
        {
            if (gridControl1.InvokeRequired)
            {
                GridGetEventArg get = new GridGetEventArg(GetGridCellValue);   //Error 1 'string Vidu.frmTinh.GetGridCellValue(int, string)' has the wrong return type
                return gridControl1.Invoke(get, new object[] { row, fieldname });//Error 2 Cannot implicitly convert type 'object' to 'string'. An explicit conversion exists (are you missing a cast?)
            }
            else
            {
                return (gridControl1.MainView as GridView).GetRowCellValue(row, fieldname);//Error 3 Cannot implicitly convert type 'object' to 'string'. An explicit conversion exists (are you missing a cast?)
            }
        }
the help you fix ?