public FilterCondition this[int index] { get { DataGridViewRow row = Rows[index]; // ".Value" can be null, so that we should to use direct cast string fld = (string)row.Cells[0].Value; string cnd = (string)row.Cells[1].Value; string val = (string)row.Cells[2].Value; FilterCondition fcond = null; if (!string.IsNullOrEmpty(fld)) { int colId = fListMan.GetFieldColumnId(fFields, fld); if (colId != -1) { ConditionKind cond = fListMan.GetCondByName(cnd); fcond = new FilterCondition((byte)colId, cond, val); } } return(fcond); } }