本文整理汇总了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);
}
示例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;
}
示例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();
}
}
}
}
示例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;
}
示例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;
}