मैं मानसी # लिस्टबॉक्स सेट चयनित आइटम
Profile 1
Profile 2
Profile 3
मैं प्रोफाइल 2 चयनित जब प्रपत्र लोड करना चाहते हैं के साथ एक सी # लिस्टबॉक्स है। मैं यह कैसे करु?
मैं मानसी # लिस्टबॉक्स सेट चयनित आइटम
Profile 1
Profile 2
Profile 3
मैं प्रोफाइल 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 ("प्रोफ़ाइल 2");
listBox1.Items.Add ("प्रोफाइल 3");
सूचीबॉक्स 1.SelectedIndex = 1;
आपका मतलब Winforms listbox है? सी # स्वयं का उपयोग कई अलग-अलग यूआई ढांचे के साथ किया जा सकता है ... –