i değerlere Ben Profil 2 zaman formu yükleri seçilmiş olmasını istiyorumC# liste kutusu seti Seçilen öğe
Profile 1
Profile 2
Profile 3
ile C# liste vardır. Bunu nasıl yaparım?
i değerlere Ben Profil 2 zaman formu yükleri seçilmiş olmasını istiyorumC# liste kutusu seti Seçilen öğe
Profile 1
Profile 2
Profile 3
ile C# liste vardır. Bunu nasıl yaparım?
Form.Shown
etkinliğinde ListBox.SelectedIndex
özelliğini ayarlayın. Form.Loaded
olay
public Form1()
{
InitializeComponent();
// Adding the event handler in the constructor
this.Shown += new EventHandler(Form1_Shown);
}
private void Form1_Shown(object sender, EventArgs e)
{
myListBox.SelectedIndex = 1;
}
mükemmel çalıştı teşekkürler – Ozzy
koyun aşağıdaki kodu: Örneğin
listBox1.SelectedItem = "Profile 2";
ListBox1.Items.Add ("Profil 1");
listBox1.Items.Add ("Profile 2");
listBox1.Items.Add ("Profile 3");
listBox1.SelectedIndex = 1;
Winforms liste kutusunu mı kastediyorsunuz? C# kendisi birçok farklı UI çerçeveleri ile kullanılabilir ... –