コード例 #1
0
ファイル: AddQuery.cs プロジェクト: wcrowe/CarCrawler
 public void SetCombos(string value, System.Windows.Forms.ComboBox combo1,
                         System.Windows.Forms.ComboBox combo2)
 {
     if (value.Length > 0)
     {
         if (value.Split(',').Length == 2)
         {
             combo1.SelectedIndex = combo1.FindString(value.Split(',')[0]);
             combo2.SelectedIndex = combo2.FindString(value.Split(',')[1]);
         }
         else
         {
             combo1.SelectedIndex = combo1.FindString(value);
         }
     }
 }
コード例 #2
0
ファイル: AddQuery.cs プロジェクト: wcrowe/CarCrawler
 public void SetCombosFormatMoney(string value, System.Windows.Forms.ComboBox combo1,
          System.Windows.Forms.ComboBox combo2)
 {
     if (value.Length > 0)
     {
         if (value.Split(',').Length == 2)
         {
             var t1 = Convert.ToDecimal(value.Split(',')[0]).ToString("C");
             var t2 = Convert.ToDecimal(value.Split(',')[1]).ToString("C");
             combo1.SelectedIndex = combo1.FindString(t1);
             combo2.SelectedIndex = combo2.FindString(t2);
         }
         else
         {
             var t1 = Convert.ToDecimal(value).ToString("C");
             combo1.SelectedIndex = combo1.FindString(t1);
         }
     }
 }
コード例 #3
0
        private static void SetComboBoxString(System.Windows.Forms.ComboBox cb, string sText)
        {
            int idx = cb.FindString(sText);
            if (idx == -1)
            {
                Styx.Helpers.Logging.Write("Dialog Error: combobox {0} does not have value '{1}' in list", cb.Name, sText);
                idx = cb.FindString("Auto");
                if (idx == -1)
                {
                    Styx.Helpers.Logging.Write("Dialog Error: combobox {0} does not have an 'Auto' value either, defaulting to first in list", cb.Name);
                    idx = 0;
                }
            }

            cb.SelectedIndex = idx;
        }
コード例 #4
0
ファイル: Util.cs プロジェクト: ingeaamex/faceid-app
 public static void SetComboboxSelectedByValue(System.Windows.Forms.ComboBox cbx, object value)
 {
     cbx.SelectedIndex = cbx.FindString(value.ToString());
 }
コード例 #5
0
ファイル: GuiChecks.cs プロジェクト: Davincier/openpetra
        /// <summary>
        /// Checks if a Combobox Text is equal the selected item.
        /// </summary>
        /// <param name="AComboBox">ComboBox Control that should be verified.</param>
        /// <returns>TVerificationResult Nil if validation succeeded, otherwise it contains
        /// details about the problem.
        /// </returns>
        public static TVerificationResult ValidateStringComboBox(System.Windows.Forms.ComboBox AComboBox)
        {
            TVerificationResult ReturnValue = null;

            if (AComboBox.SelectedItem == null)
            {
                ReturnValue = new TVerificationResult(AComboBox.Name, ErrorCodes.GetErrorInfo(
                        CommonErrorCodes.ERR_INFORMATIONMISSING, StrNoItemSelected));
            }

            if (AComboBox.FindString(AComboBox.Text) != AComboBox.SelectedIndex)
            {
                ReturnValue = new TVerificationResult(AComboBox.Name, ErrorCodes.GetErrorInfo(
                        CommonErrorCodes.ERR_INFORMATIONMISSING, StrNonExistingItem));
            }

            return ReturnValue;
        }