当前位置: 首页>>代码示例>>C#>>正文


C# ListBox.FindString方法代码示例

本文整理汇总了C#中System.Windows.Forms.ListBox.FindString方法的典型用法代码示例。如果您正苦于以下问题:C# ListBox.FindString方法的具体用法?C# ListBox.FindString怎么用?C# ListBox.FindString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.ListBox的用法示例。


在下文中一共展示了ListBox.FindString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowDonorPanel

        /// <summary>
        ///     Constructs a ShowDonorPanel object
        /// </summary>
        /// <param name="sales"></param>
        public ShowDonorPanel(ListBox list, string selectedName)
        {
            // sales should be from the same donor

            InitializeComponent();

            initialize();
            listBoxResults.Items.AddRange(list.Items);
            listBoxResults.SelectedIndex = list.FindString(selectedName);
            selectBrickImage(null, null, null);
        }
开发者ID:Jrobinson79,项目名称:TeamJ,代码行数:15,代码来源:ShowDonorPanel.cs

示例2: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (((context != null) && (context.Instance != null)) && (provider != null))
            {
                base.editorService = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService));
                if (base.editorService == null)
                {
                    return value;
                }
                ListBox box1 = new ListBox();
                float[] singleArray1 = new float[] {
                                                       8f, 9f, 10f, 11f, 12f, 13f, 14f, 16f, 18f, 20f, 22f, 24f, 26f, 28f, 36f, 48f,
                                                       72f, 80f, 88f, 96f, 128f, 168f
                                                   } ;
                for (int num1 = 0; num1 < singleArray1.Length; num1++)
                {
                    box1.Items.Add(singleArray1[num1]);
                }

                singleArray1 = null;
                box1.BorderStyle = BorderStyle.None;
                box1.Height = 150;
                box1.Width = 80;
                if(value!=null)
                {
                    //Struct.Float fl= (Struct.Float) value;
                    float f1 = (float)value;
                    box1.SelectedIndex = box1.FindString(f1.ToString());
                }
                box1.SelectedIndexChanged += new EventHandler(this.selectedIndexChanged);
                base.editorService.DropDownControl(box1);
                if (this.selectChanged && (box1.SelectedItem != null))
                {
                    try
                    {
                        //value =new Struct.Float( float.Parse(box1.SelectedItem.ToString()));
                        value = float.Parse(box1.SelectedItem.ToString());
                    }
                    catch
                    {
                    }
                }
                this.selectChanged = false;
            }
            return value;
        }
开发者ID:EdgarEDT,项目名称:myitoppsp,代码行数:46,代码来源:ListFontSize.cs

示例3: addUitlening

        /// <summary> addUitlening voegt een nieuwe uitlening toe.
        /// <para>Er wordt een nieuwe uitlening in de Database aangemaakt mbv de gegeven parameters.</para>
        /// </summary>
        /// <param name="Reserveringsnummer">Het reserveringsnummer van de klant.</param>
        /// <param name="mat">Het materiaal dat de klant wil lenen.</param>
        /// <param name="Uitgeleend">De datum waarop de uitlening van start gaat.</param>
        /// <param name="Ingeleverd">De datum waarop het materiaal uiterlijk teruggebracht moet worden.</param>
        /// <param name="lBox">De listbox met beschikbare materiaal dat al door de klant gehuurd wordt (Wordt gebruikt om te kijken of er een INSERT of UPDATE SQL commando uitgevoerd moet worden.</param>
        public static void addUitlening(int Reserveringsnummer, Materiaal mat, DateTime Uitgeleend, DateTime Ingeleverd, ListBox lBox)
        {
            {
                if (lBox.FindString(mat.Type) == ListBox.NoMatches)
                {
                    string nieuwuitleningins = "INSERT INTO UITLENING (RESERVERINGSNUMMER, TYPE, BETAALD, DATUM_UITGELEEND, DATUM_INGELEVERD, AANTAL) VALUES(" + Reserveringsnummer + ", " + "'" + mat.Type + "', '" + "', '" + Uitgeleend.ToString("dd/MM/yyyy") + "', '" + Ingeleverd.ToString("dd/MM/yyyy") + "', 1)";
                    OracleCommand insertuitleningcmd = new OracleCommand(nieuwuitleningins, conn);

                    try
                    {
                        conn.Open();
                        insertuitleningcmd.ExecuteNonQuery();
                    }
                    catch (Exception ef)
                    {
                        System.Windows.Forms.MessageBox.Show(ef.Message);
                    }
                    finally
                    {
                        conn.Close();
                    }
                }

                else
                {
                    string sqlverhoogaantal = "UPDATE UITLENING SET AANTAL = AANTAL + 1 WHERE (RESERVERINGSNUMMER = " + Reserveringsnummer + " AND TYPE = '" + mat.Type + "')";
                    OracleCommand verhoogcmd = new OracleCommand(sqlverhoogaantal, conn);
                    try
                    {
                        conn.Open();
                        verhoogcmd.ExecuteNonQuery();

                    }
                    catch (Exception fe)
                    {

                        MessageBox.Show(fe.Message);
                    }
                    finally
                    {
                        conn.Close();
                    }
                }
            }
        }
开发者ID:DutchSoldier,项目名称:FHSICT,代码行数:53,代码来源:DatabaseKoppeling.cs

示例4: EditValue

        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            if (((context != null) && (context.Instance != null)) && (provider != null))
            {
                base.editorService = (IWindowsFormsEditorService) provider.GetService(typeof(IWindowsFormsEditorService));
                if (base.editorService == null)
                {
                    return value;
                }
                if(value==null)return value;

                ListBox box1 =new ListBox();

                if (value is SvgElement )
                {

                    XmlNodeList list = (value as SvgElement).OwnerDocument.GetElementsByTagName("layer");
                    foreach(Layer layer in list)
                    {
                        if (layer !=null)
                        {
                            box1.Items.Add(layer);
                        }
                    }
                }
                box1.BorderStyle = BorderStyle.None;
                box1.Height = 150;
                box1.SelectedIndex = box1.FindString(value.ToString());
                box1.SelectedIndexChanged += new EventHandler(this.selectedIndexChanged);
                base.editorService.DropDownControl(box1);
                if (this.selectChanged && (box1.SelectedItem != null))
                {
                    value = box1.SelectedItem;
                }

                this.selectChanged = false;
            }
            return value;
        }
开发者ID:EdgarEDT,项目名称:myitoppsp,代码行数:39,代码来源:LayerEdit.cs

示例5: EditValue

        public override object EditValue(System.ComponentModel.ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            // Uses the IWindowsFormsEditorService to display a 
            // drop-down UI in the Properties window.
            IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (edSvc != null)
            {
                // Display an angle selection control and retrieve the value.
                ListBox lb = new ListBox();
                lb.BorderStyle = BorderStyle.None;
                lb.Dock = DockStyle.Fill;
                lb.Height = 250;
                lb.Tag = edSvc;

                lb.SelectedIndexChanged += new EventHandler(lb_SelectedIndexChanged);

                lb.Items.Add(string.Empty); // no genre
                foreach (string gi in ID3FileInfo.AudioGenres)
                {
                    lb.Items.Add(gi);
                }

                lb.SelectedIndex = lb.FindString(value as string);

                edSvc.DropDownControl(lb);

                return (string)lb.SelectedItem;

            }

            return value;

        }
开发者ID:rraguso,项目名称:protone-suite,代码行数:33,代码来源:ID3FileInfo.cs


注:本文中的System.Windows.Forms.ListBox.FindString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。