private void PopulateComboBoxes()
        {
            // For some reason this method enables the save button

            // temporarily remove the event that enables the save button when data is changed
            FPetraUtilsObject.ActionEnablingEvent -= ((TFrmPartnerEdit)FPetraUtilsObject.GetForm()).ActionEnabledEvent;
            bool HasChanges = FPetraUtilsObject.HasChanges;

            // temporily remove events from comboboxes
            cmbBankName.SelectedValueChanged -= new System.EventHandler(this.BankNameChanged);
            cmbBankCode.SelectedValueChanged -= new System.EventHandler(this.BankCodeChanged);

            // load bank records
            if (FBankDataset == null)
            {
                FBankDataset = TRemote.MPartner.Partner.WebConnectors.GetPBankRecords();
                txtBankKey.DataSet = FBankDataset;
            }

            // create new datatable without any partnerkey duplicates (same bank with different locations)
            PBankTable ComboboxTable = new PBankTable();
            bool CreateInactiveCode = false;

            foreach (BankTDSPBankRow Row in FBankDataset.PBank.Rows)
            {
                if (!ComboboxTable.Rows.Contains(Row.PartnerKey))
                {
                    PBankRow AddRow = (PBankRow)ComboboxTable.NewRow();
                    AddRow.PartnerKey = Row.PartnerKey;
                    AddRow.BranchName = Row.BranchName;
                    AddRow.BranchCode = Row.BranchCode;
                    ComboboxTable.Rows.Add(AddRow);

                    if (Row.BranchCode == SharedConstants.INACTIVE_VALUE_WITH_QUALIFIERS + " ")
                    {
                        CreateInactiveCode = true;
                    }
                }
            }

            // add empty row
            DataRow emptyRow = ComboboxTable.NewRow();
            emptyRow[PBankTable.ColumnPartnerKeyId] = -1;
            emptyRow[PBankTable.ColumnBranchNameId] = Catalog.GetString("");
            emptyRow[PBankTable.ColumnBranchCodeId] = Catalog.GetString("");
            ComboboxTable.Rows.Add(emptyRow);

            if (CreateInactiveCode)
            {
                // add inactive row
                emptyRow = ComboboxTable.NewRow();
                emptyRow[PBankTable.ColumnPartnerKeyId] = -2;
                emptyRow[PBankTable.ColumnBranchNameId] = Catalog.GetString("");
                emptyRow[PBankTable.ColumnBranchCodeId] = SharedConstants.INACTIVE_VALUE_WITH_QUALIFIERS + " ";
                ComboboxTable.Rows.Add(emptyRow);
            }

            // populate the bank name combo box
            cmbBankName.InitialiseUserControl(ComboboxTable,
                PBankTable.GetPartnerKeyDBName(),
                PBankTable.GetBranchNameDBName(),
                PBankTable.GetBranchCodeDBName(),
                null);

            cmbBankName.AppearanceSetup(new int[] { 230, 160 }, -1);
            cmbBankName.Filter = PBankTable.GetBranchNameDBName() + " <> '' OR " +
                                 PBankTable.GetBranchNameDBName() + " = '' AND " + PBankTable.GetBranchCodeDBName() + " = ''";

            cmbBankName.SelectedValueChanged += new System.EventHandler(this.BankNameChanged);

            // populate the bank code combo box
            cmbBankCode.InitialiseUserControl(ComboboxTable,
                PBankTable.GetBranchCodeDBName(),
                PBankTable.GetPartnerKeyDBName(),
                null);

            cmbBankCode.AppearanceSetup(new int[] { 210 }, -1);
            // filter rows that are blank or <INACTIVE>
            cmbBankCode.Filter = "(" + PBankTable.GetBranchCodeDBName() + " <> '' AND " + PBankTable.GetBranchCodeDBName() + " <> '" +
                                 SharedConstants.INACTIVE_VALUE_WITH_QUALIFIERS + " ') " +
                                 "OR (" + PBankTable.GetBranchNameDBName() + " = '' AND " + PBankTable.GetBranchCodeDBName() + " = '') " +
                                 "OR (" + PBankTable.GetBranchNameDBName() + " = '' AND " + PBankTable.GetBranchCodeDBName() + " = '" +
                                 SharedConstants.INACTIVE_VALUE_WITH_QUALIFIERS + " ')";
            cmbBankCode.SelectedValueChanged += new System.EventHandler(this.BankCodeChanged);

            FComboBoxesCreated = true;

            if ((FPreviouslySelectedDetailRow != null) && (FPreviouslySelectedDetailRow.BankKey != 0)
                && (((FCurrentBankRow == null) || (FPreviouslySelectedDetailRow.BankKey != FCurrentBankRow.PartnerKey))))
            {
                PartnerKeyChanged(FPreviouslySelectedDetailRow.BankKey, "", true);
            }

            FPetraUtilsObject.ActionEnablingEvent += ((TFrmPartnerEdit)FPetraUtilsObject.GetForm()).ActionEnabledEvent;
            FPetraUtilsObject.HasChanges = HasChanges;
        }
        /// <summary>
        /// Populates cmbBankName and cmbBankCode (loads data from database if needed)
        /// </summary>
        public void PopulateBankComboBoxes()
        {
            // temporily remove events from comboboxes
            cmbBankName.SelectedValueChanged -= new System.EventHandler(this.BankNameChanged);
            cmbBankCode.SelectedValueChanged -= new System.EventHandler(this.BankCodeChanged);

            // Load bank records. (I don't think this will ever be null. Database is populated when tab is loaded.)
            if (FBankDataset == null)
            {
                FBankDataset = TRemote.MPartner.Partner.WebConnectors.GetPBankRecords();
            }

            txtBankKey.DataSet = FBankDataset;

            // create new datatable without any partnerkey duplicates (same bank with different locations)
            PBankTable ComboboxTable = new PBankTable();

            foreach (BankTDSPBankRow Row in FBankDataset.PBank.Rows)
            {
                if (!ComboboxTable.Rows.Contains(Row.PartnerKey))
                {
                    PBankRow AddRow = (PBankRow)ComboboxTable.NewRow();
                    AddRow.PartnerKey = Row.PartnerKey;
                    AddRow.BranchName = Row.BranchName;
                    AddRow.BranchCode = Row.BranchCode;
                    ComboboxTable.Rows.Add(AddRow);
                }
            }

            // add empty row
            DataRow emptyRow = ComboboxTable.NewRow();
            emptyRow[PBankTable.ColumnPartnerKeyId] = -1;
            emptyRow[PBankTable.ColumnBranchNameId] = Catalog.GetString("");
            emptyRow[PBankTable.ColumnBranchCodeId] = Catalog.GetString("");
            ComboboxTable.Rows.Add(emptyRow);

            // add inactive row
            emptyRow = ComboboxTable.NewRow();
            emptyRow[PBankTable.ColumnPartnerKeyId] = -2;
            emptyRow[PBankTable.ColumnBranchNameId] = Catalog.GetString("");
            emptyRow[PBankTable.ColumnBranchCodeId] = SharedConstants.INACTIVE_VALUE_WITH_QUALIFIERS + " ";
            ComboboxTable.Rows.Add(emptyRow);

            // populate the bank name combo box
            cmbBankName.InitialiseUserControl(ComboboxTable,
                PBankTable.GetPartnerKeyDBName(),
                PBankTable.GetBranchNameDBName(),
                PBankTable.GetBranchCodeDBName(),
                null);
            cmbBankName.Filter = PBankTable.GetBranchNameDBName() + " <> '' OR " +
                                 PBankTable.GetBranchNameDBName() + " = '' AND " + PBankTable.GetBranchCodeDBName() + " = ''";
            cmbBankName.SelectedValueChanged += new System.EventHandler(this.BankNameChanged);

            // populate the bank code combo box
            cmbBankCode.InitialiseUserControl(ComboboxTable,
                PBankTable.GetBranchCodeDBName(),
                PBankTable.GetPartnerKeyDBName(),
                null);
            // filter rows that are blank or <INACTIVE>
            cmbBankCode.Filter = "(" + PBankTable.GetBranchCodeDBName() + " <> '' AND " + PBankTable.GetBranchCodeDBName() + " <> '" +
                                 SharedConstants.INACTIVE_VALUE_WITH_QUALIFIERS + " ') " +
                                 "OR (" + PBankTable.GetBranchNameDBName() + " = '' AND " + PBankTable.GetBranchCodeDBName() + " = '') " +
                                 "OR (" + PBankTable.GetBranchNameDBName() + " = '' AND " + PBankTable.GetBranchCodeDBName() + " = '" +
                                 SharedConstants.INACTIVE_VALUE_WITH_QUALIFIERS + " ')";
            cmbBankCode.SelectedValueChanged += new System.EventHandler(this.BankCodeChanged);

            FComboBoxesCreated = true;
        }