Example #1
0
        private void btnPostal_Click(object sender, EventArgs e)
        {
            Form         frmPostal = new frmPostal();
            DialogResult dlg       = frmPostal.ShowDialog();

            if (dlg == DialogResult.OK && SharedData.sPostal.Length > 0)
            {
                bool bExists = false;

                foreach (DevComponents.Editors.ComboItem i in cbxPostal.Items)
                {
                    if (i.Value.ToString().ToLower() == SharedData.sPostal.ToLower())
                    {
                        bExists = true;
                    }
                }

                if (bExists)
                {
                    MessageBox.Show("The address entered already exists.", "Exists", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    string[] sPostal = SharedData.sPostal.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                    DevComponents.Editors.ComboItem i = new DevComponents.Editors.ComboItem();
                    i.Value = SharedData.sPostal;
                    i.Text  = sPostal[0] + ", " + sPostal[5];
                    cbxPostal.Items.Add(i);
                    cbxPostal.SelectedIndex = cbxPostal.Items.Count - 1;
                }

                SharedData.sPostal = "";
            }
            return;
        }
Example #2
0
        private void btnPostal_Click(object sender, EventArgs e)
        {
            Form frmPostal = new frmPostal();
            DialogResult dlg = frmPostal.ShowDialog();
            if (dlg == DialogResult.OK && SharedData.sPostal.Length > 0)
            {
                bool bExists = false;

                foreach (DevComponents.Editors.ComboItem i in cbxPostal.Items)
                {
                    if (i.Value.ToString().ToLower() == SharedData.sPostal.ToLower())
                    {
                        bExists = true;
                    }
                }

                if (bExists)
                {
                    MessageBox.Show("The address entered already exists.", "Exists", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                }
                else
                {
                    string[] sPostal = SharedData.sPostal.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
                    DevComponents.Editors.ComboItem i = new DevComponents.Editors.ComboItem();
                    i.Value = SharedData.sPostal;
                    i.Text = sPostal[0] + ", " + sPostal[5];
                    cbxPostal.Items.Add(i);
                    cbxPostal.SelectedIndex = cbxPostal.Items.Count - 1;
                }

                SharedData.sPostal = "";
            }
            return;
        }