Profile 1
Profile 2
Profile 3
とC#のリストボックスを持っている私は、プロファイルフォームのロード選択した2を持っていると思います。これはどうすればいいですか?
Profile 1
Profile 2
Profile 3
とC#のリストボックスを持っている私は、プロファイルフォームのロード選択した2を持っていると思います。これはどうすればいいですか?
Form.Shown
イベントのListBox.SelectedIndex
プロパティを設定します。 Form.Loaded
イベントで
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;
}
完璧に感謝した – Ozzy
プット以下のコード:例えば
listBox1.SelectedItem = "Profile 2";
listBox1.Items.Add( "プロファイル1")。
listBox1.Items.Add( "Profile 2");
listBox1.Items.Add( "Profile 3");
listBox1.SelectedIndex = 1;
Winformsリストボックスを意味しますか? C#自体は、さまざまなUIフレームワークで使用することができます... –