private void OnShipperTextChanged(object sender, EventArgs e) { //Event handler for shipper TextChanged event- clear bound fields when user clears shipper text this.Cursor = Cursors.WaitCursor; try { if (this.cboShipper.SelectedIndex == -1) { this.txtAddressLine1.Text = ""; this.txtAddressLine2.Text = ""; this.txtCity.Text = ""; this.txtState.Text = ""; this.txtZip.Text = ""; this.txtZip4.Text = ""; //this.txtContactName.Text = ""; //this.txtContactPhone.Text = ""; //this.txtContactEmail.Text = ""; //this.mtbOpen.Text = this.mtbClose.Text = ""; } else if (this.cboShipper.SelectedValue != null) { string vendorNumber = this.cboShipper.SelectedValue.ToString(); DispatchDataset.VendorTableRow vendor = FreightGateway.GetVendor(vendorNumber); if (vendor != null) { this.txtAddressLine1.Text = vendor.AddressLine1; this.txtAddressLine2.Text = !vendor.IsAddressLine2Null() ? vendor.AddressLine2 : ""; this.txtCity.Text = vendor.City; this.txtState.Text = vendor.State; this.txtZip.Text = vendor.Zip; this.txtZip4.Text = !vendor.IsZip4Null() ? vendor.Zip4 : ""; } } } catch (Exception ex) { App.ReportError(ex, false, LogLevel.Warning); } finally { OnValidateForm(null, null); this.Cursor = Cursors.Default; } }