Control - LISTBOX

 

Die ListBox - das abbilden und auswählen von Inhalten und damit DATEN.

 

 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace ListBox
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
for (int i = 0; i < 100; i++)
{
listBox1.Items.Add(i);
}
}

private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
{
int ausgewaehlt = (int)listBox1.SelectedItem;
label1.Text = "Die Zahl ist: " + ausgewaehlt;
}
}
}

Top