private void OnFormLoad(object sender, System.EventArgs e) { //Initialize controls - set default values this.Cursor = Cursors.WaitCursor; try { //Show early this.Visible = true; Application.DoEvents(); //Get selection lists this.mTypesDS.Merge(EnterpriseFactory.GetAddressTypes()); this.mCountriesDS.Merge(EnterpriseFactory.GetCountries()); this.mStatesDS.Merge(EnterpriseFactory.GetStates()); //Load details if (this.mAddressDS.AddressViewTable[0].AddressType != "") { this.cboTypes.SelectedValue = this.mAddressDS.AddressViewTable[0].AddressType; } else if (this.cboTypes.Items.Count > 0) { this.cboTypes.SelectedIndex = 0; } this.cboTypes.Enabled = false; this.txtLine1.MaxLength = 40; this.txtLine1.Text = this.mAddressDS.AddressViewTable[0].AddressLine1; this.txtLine2.MaxLength = 40; this.txtLine2.Text = ""; if (!this.mAddressDS.AddressViewTable[0].IsAddressLine2Null()) { this.txtLine2.Text = this.mAddressDS.AddressViewTable[0].AddressLine2; } this.txtCity.MaxLength = 40; this.txtCity.Text = this.mAddressDS.AddressViewTable[0].City; if (!this.mAddressDS.AddressViewTable[0].IsStateOrProvinceNull()) { this.cboStates.SelectedValue = this.mAddressDS.AddressViewTable[0].StateOrProvince; } else if (this.cboStates.Items.Count > 0) { this.cboStates.SelectedIndex = 0; } this.cboStates.Enabled = (this.cboStates.Items.Count > 0); this.txtZip.MaxLength = 15; this.txtZip.Text = ""; if (!this.mAddressDS.AddressViewTable[0].IsPostalCodeNull()) { this.txtZip.Text = this.mAddressDS.AddressViewTable[0].PostalCode; } if (!this.mAddressDS.AddressViewTable[0].IsCountryIDNull()) { this.cboCountries.SelectedValue = this.mAddressDS.AddressViewTable[0].CountryID; } else if (this.cboCountries.Items.Count > 0) { this.cboCountries.SelectedIndex = 0; } this.cboCountries.Enabled = (this.cboCountries.Items.Count > 0); this.chkStatus.Checked = this.mAddressDS.AddressViewTable[0].IsActive; } catch (Exception ex) { reportError(ex); } finally { this.btnOk.Enabled = false; this.Cursor = Cursors.Default; } }