/// <summary>
        /// Sets up the columns and rows of the Grid.
        ///
        /// </summary>
        /// <returns>void</returns>
        private void SetupGridColumnsAndRows()
        {
            Int32 GroupHeaderCount;
            Int32 Counter;
            Int32 CurrentRow;

            SourceGrid.Cells.Views.Cell LabelModel;
            SourceGrid.Cells.Views.Cell TitleModel;
            String CurrentGroup;
            String LastGroup = "";
            String LabelUse;
            PDataLabelRow DataLabelRow;
            DataColumn ForeignTableColumn;

            // Create class that hooks up Grid Cell Enter event notification
            FEnterNotificationController = new TCellEventNotificationController();
            FEnterNotificationController.Initialize(this);
            FLabelUseDV = new DataView(FLocalDataDS.DataLabelUseList);

            // Create DataColumns that contain data from the DataLabel DataTable
            // add column: group of the data label
            ForeignTableColumn = new DataColumn();
            ForeignTableColumn.DataType = System.Type.GetType("System.String");
            ForeignTableColumn.ColumnName = "Parent_" + PDataLabelTable.GetGroupDBName();
            ForeignTableColumn.Expression = "Parent." + PDataLabelTable.GetGroupDBName();
            FLocalDataDS.DataLabelUseList.Columns.Add(ForeignTableColumn);

            // add column: is this label to be displayed
            ForeignTableColumn = new DataColumn();
            ForeignTableColumn.DataType = System.Type.GetType("System.Boolean");
            ForeignTableColumn.ColumnName = "Parent_" + PDataLabelTable.GetDisplayedDBName();
            ForeignTableColumn.Expression = "Parent." + PDataLabelTable.GetDisplayedDBName();
            FLocalDataDS.DataLabelUseList.Columns.Add(ForeignTableColumn);
            LabelUse = Enum.GetName(typeof(TOfficeSpecificDataLabelUseEnum), FOfficeSpecificDataLabelUse);

            // Sort by Index
            FLabelUseDV.Sort = PDataLabelUseTable.GetIdx1DBName() + " ASC";

            // Show only Labels that should get displayed and are of the type that this UserControl is for
            FLabelUseDV.RowFilter = PDataLabelUseTable.GetUseDBName() + " = '" + LabelUse + "' AND Parent_" + PDataLabelTable.GetDisplayedDBName() +
                                    " = 1";

            // MessageBox.Show('FLabelUseDV.RowFilter: ' + FLabelUseDV.RowFilter);
            // MessageBox.Show('FLabelUseDV.Count: ' + FLabelUseDV.Count.ToString);
            GroupHeaderCount = CalculateGroupHeaderCount();

            // Set up Grid focus style
            // FLocalDataLabelValuesGrid.Selection.FocusStyle := SourceGrid.FocusStyle.RemoveSelectionOnLeave;
            // Set up Grid size
            FLocalDataLabelValuesGrid.Redim((FLabelUseDV.Count) + GroupHeaderCount, 3);

            // Initialize Size of Helper Object GridRowInfo (mapping between data and grid rows)
            FGridRowInfo = new TGridRowInfo();
            FGridRowInfo.Initialize(FLabelUseDV.Count + GroupHeaderCount);
            TitleModel = new SourceGrid.Cells.Views.Cell();
            TitleModel.BackColor = Color.SteelBlue;
            TitleModel.ForeColor = Color.White;
            TitleModel.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
            LabelModel = new SourceGrid.Cells.Views.Cell();
            LabelModel.BackColor = FLocalDataLabelValuesGrid.BackColor;
            LabelModel.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight;
            CurrentRow = 0;

            for (Counter = 0; Counter <= FLabelUseDV.Count - 1; Counter += 1)
            {
                // Find the corresponding DataLabel Row
                DataLabelRow = (PDataLabelRow)FLocalDataDS.DataLabelList.Rows.Find(FLabelUseDV[Counter][PDataLabelUseTable.GetDataLabelKeyDBName()]);
                CurrentGroup = DataLabelRow.Group;

                if (CurrentGroup != LastGroup)
                {
                    // Create group header if Group changed
                    FLocalDataLabelValuesGrid.Rows.SetHeight(CurrentRow, 23);
                    FLocalDataLabelValuesGrid[CurrentRow, 0] = new SourceGrid.Cells.Cell(CurrentGroup);
                    FLocalDataLabelValuesGrid[CurrentRow, 0].View = TitleModel;
                    FLocalDataLabelValuesGrid[CurrentRow, 0].ColumnSpan = 3;
                    FLocalDataLabelValuesGrid[CurrentRow, 0].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);
                    CurrentRow = CurrentRow + 1;
                }

                // Create label (left of the field)
                FLocalDataLabelValuesGrid.Rows.SetHeight(CurrentRow, 23);
                FLocalDataLabelValuesGrid[CurrentRow, 0] = new SourceGrid.Cells.Cell(DataLabelRow.Text + ':');
                FLocalDataLabelValuesGrid[CurrentRow, 0].View = LabelModel;
                FLocalDataLabelValuesGrid[CurrentRow, 0].AddController(SourceGrid.Cells.Controllers.Unselectable.Default);

                // MessageBox.Show('Counter: ' + Counter.ToString);
                // MessageBox.Show('FPartnerKey: ' + FPartnerKey.ToString + '; FLocalDataDS.DataLabelList.Row[Counter].Key: ' + FLocalDataDS.DataLabelList.Row[Counter].Key.ToString);
                // set up the value cell(s) for the current row
                SetupGridValueCell(CurrentRow, DataLabelRow);

                // Some TODOs
                // Check for the p_editable_l flag and make column 1 readonly if true
                // should go like this: FLocalDataLabelValuesGrid[CurrentRow, 1].Editor.EnableEdit := false;
                // Check the value of p_char_length_i and limit the length of the editable value
                // see commentedout line above 'TextBoxEditor.Control.MaxLength := '
                // Check the value of p_num_decimal_places_i build the corresponding format for the cell
                // see 'Editor' section on webpage
                // Implement currency (take p_currency_code_c into consideration), boolean and PartnerKey types
                // Implement cmbAutoComplete ComboBox (in Ict_Common_Controls.dll) for Labels where p_lookup_category_code_c is set
                // see file AutoTranslatedCSExampleWinForm, lines 465470 for a basic example of how to host an arbitraty control in a Cell of the Grid
                // MessageBox.Show('CurrentRow: ' + CurrentRow.ToString);
                // Hook up Grid Cell Enter event notification (for displaying Help text in the Status Bar)
                FLocalDataLabelValuesGrid[CurrentRow, 1].AddController(FEnterNotificationController);

                // Store the mapping of the current Grid Row to the PDataLabel Row that holds the Cell's Label information
                FGridRowInfo.SetDataRowKey(CurrentRow, (int)DataLabelRow.Key);
                CurrentRow = CurrentRow + 1;
                LastGroup = CurrentGroup;
            }

            // FLocalDataLabelValuesGrid.Columns[0].AutoSizeMode := (SourceGrid.AutoSizeMode.EnableAutoSize);   or SourceGrid.AutoSizeMode.Default
            // FLocalDataLabelValuesGrid.Columns[1].AutoSizeMode := (SourceGrid.AutoSizeMode.EnableAutoSize);   or SourceGrid.AutoSizeMode.Default
            // FLocalDataLabelValuesGrid.Columns[2].AutoSizeMode := (SourceGrid.AutoSizeMode.EnableAutoSize);   or SourceGrid.AutoSizeMode.Default
            FLocalDataLabelValuesGrid.Columns[0].AutoSizeMode = (SourceGrid.AutoSizeMode.MinimumSize | SourceGrid.AutoSizeMode.Default);
            FLocalDataLabelValuesGrid.Columns[1].AutoSizeMode = (SourceGrid.AutoSizeMode.MinimumSize | SourceGrid.AutoSizeMode.Default);
            FLocalDataLabelValuesGrid.Columns[2].AutoSizeMode = (SourceGrid.AutoSizeMode.MinimumSize | SourceGrid.AutoSizeMode.Default);

            // This grid does not work the same way as our 'normal' grids, so we need to modify the keyboard handling
            FLocalDataLabelValuesGrid.SpecialKeys = FLocalDataLabelValuesGrid.SpecialKeys | GridSpecialKeys.SimplifiedTabEnter;

            // FLocalDataLabelValuesGrid.AutoSize;
            FLocalDataLabelValuesGrid.AutoStretchColumnsToFitWidth = true;
            FLocalDataLabelValuesGrid.Columns.StretchToFit();
            ApplySecurity();
            FGridIsSetUp = true;

            // set width for controls (comboboxes and buttons)
            ActUponGridSizeChanged();
        }
 /// <summary>
 /// Needs to be called from the instantiator of this Class once it is
 /// done with using this class to ensure that no memory leak occurs!!!
 /// </summary>
 public void FreeStaticObjects()
 {
     FGridRowInfo = null;
     FLocalDataLabelValuesGrid = null;
 }