Sunday 24 August 2014

Group the DataGrid on windows Application in C#

//private void GroupGrid()
        //{

        //    string strCurrentValue = string.Empty;
        //    string strPreviousValue = string.Empty;
        //    int m;
        //    for (m = 1; m < dgvMikeBasin.Cols.Count; m++)
        //    {

        //        object cellValue = dgvMikeBasin.Rows[m]["Parameter Type"]; // Here we catch the value form current column
        //        strCurrentValue = cellValue.ToString().Trim(); // We assign the above value to 'strCurrentValue'

        //        if (strCurrentValue != strPreviousValue) // Now compare the current value with previous value
        //        {
        //            dgvMikeBasin.Rows[m]["Parameter Type"] = strCurrentValue; // If current value is not equal to previous value
        //            // the column will display current value
        //        }
        //        else
        //        {
        //            dgvMikeBasin.Rows[m]["Parameter Type"] = string.Empty; // If current value is equal to previous value
        //            // the column will be empty
        //        }
        //        strPreviousValue = strCurrentValue;         // assign current value to previous value
        //    }
        //    strCurrentValue = string.Empty;     // Reset Current and Previous Value
        //    strPreviousValue = string.Empty;
        //}

No comments:

Post a Comment