Ejemplo n.º 1
0
        public void SelectOption(int value)
        {
            //Loop through the values.
            for (int i = 0; i < EnumOptions.Count; i++)
            {
                //If the enum option value is this value
                if (EnumOptions[i].Value == value)
                {
                    //Select it.
                    cmbxSelections.SelectedIndex = i;
                    //Return out of this function
                    return;
                }
            }
            //Otherwise add the new read value
            mEnumOption enumOption = new mEnumOption();

            //Set the name
            enumOption.Name = "<unknown>(" + value + ")";
            //Set the value
            enumOption.Value = value;
            //Add it to the list
            EnumOptions.Add(enumOption);
            //Add it to the comboBox
            cmbxSelections.Items.Add(enumOption.Name);
            //Select it
            cmbxSelections.SelectedIndex = cmbxSelections.Items.Count - 1;
        }
Ejemplo n.º 2
0
        public void SelectOption(int value)
        {
            for (int i = 0; i < EnumOptions.Count; i++)
            {
                if (EnumOptions[i].Value == value)
                {
                    cmbxOptions.SelectedIndex = i;
                    return;
                }
            }
            mEnumOption item = new mEnumOption {
                Name  = "<unknown>(" + value + ")",
                Value = value
            };

            EnumOptions.Add(item);
            cmbxOptions.Items.Add(item.Name);
            cmbxOptions.SelectedIndex = cmbxOptions.Items.Count - 1;
        }