C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
Next: We add several items to the DomainUpDown control. The current item can be determined or set with the Text property.
C# program that uses DomainUpDown control
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
// Items.
DomainUpDown.DomainUpDownItemCollection items = this.domainUpDown1.Items;
items.Add("Dot");
items.Add("Net");
items.Add("Perls");
// Set Text.
this.domainUpDown1.Text = "Dot";
}
private void domainUpDown1_SelectedItemChanged(object sender, EventArgs e)
{
// Run code every time the item is changed.
this.Text = domainUpDown1.Text;
}
}
}