C#列表框组选择的项目
答
在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;
}
+0
完美谢谢 – Ozzy 2010-12-15 18:36:43
答
穿戴以下代码:
listBox1.SelectedItem = "Profile 2";
答
listBox1.Items.Add( “资料1”);
listBox1.Items.Add(“Profile 2”);
listBox1.Items.Add(“Profile 3”);
listBox1.SelectedIndex = 1;
你的意思是一个Winforms列表框? C#本身可以用于许多不同的UI框架... – 2010-12-15 18:23:26