コード例 #1
0
        private void cvState_Validating(object sender, Genghis.Windows.Forms.CustomValidator.ValidationCancelEventArgs e)
        {
            var states = ZoneGenerator.GenerateStateIDsByCountry(address.Data.Country);

            var stateFound = states.FirstOrDefault(c => c.TrimEnd() == cboState.Text.TrimEnd());

            e.Valid = stateFound != null;
        }
コード例 #2
0
        private void cboState_Leave(object sender, EventArgs e)
        {
            var index = ZoneGenerator.GenerateStateIDsByCountry(address.Data.Country).FindIndex(c => c.TrimEnd() == cboState.Text.TrimEnd().ToUpper());

            if (index != -1)
            {
                cboState.SelectedIndex = index + 1;
                cvState.Validate();
            }
        }
コード例 #3
0
        private void PopulateStateComboBox()
        {
            UnsubscribeToStateChanged();

            var states = ZoneGenerator.GenerateStateIDsByCountry(address.Data.Country);

            cboState.Items.Clear();
            states.ForEach(c => cboState.Items.Add(c));
            cboState.Items.Insert(0, "");

            SubscribeToStateChanged();
        }
コード例 #4
0
        private void SetState()
        {
            var states = ZoneGenerator.GenerateStateIDsByCountry(address.Data.Country);
            var index  = states.FindIndex(c => c.TrimEnd() == address.Data.State);

            if (index != -1)
            {
                cboState.SelectedIndex = index + 1; //make up for empty option
            }
            else
            {
                cboState.SelectedIndex = 0;
            }
        }