c# - How do I Change comboBox.Text inside a comboBox.SelectedIndexChanged event? -


कोड उदाहरण:

  निजी शून्य comboBox_SelectedIndexChanged (ऑब्जेक्ट प्रेषक, EventArgs ई) {if ( कुछ स्थिति) {comboBox.Text = "new string"}}  

मेरी समस्या यह है कि कॉम्बोबॉक्स पाठ हमेशा चयनित इंडेक्स के स्ट्रिंग मान को दिखाता है और नये स्ट्रिंग नहीं। क्या यह एक रास्ता है?

यह कोड काम करना चाहिए ...

  सार्वजनिक फॉर्म 1 () {InitializeComponent (); ComboBox1.Items.AddRange (नया स्ट्रिंग [] {"आइटम 1", "आइटम 2", "आइटम 3"}); } निजी शून्य comboBox1 से चुने गए इंडेक्स (वस्तु प्रेषक, EventArgs ई) {स्ट्रिंग पाठ = "आपने चुना:" + comboBox1.Text; BeginInvoke (नई एक्शन (() = & gt; comboBox1.Text = text)); }  

आशा है कि यह मदद करता है ... :)


Comments

Popular posts from this blog

SQL/PHP: Table design question -

NHibernate Passing Session to the Repository -

c# - XMLDocument.Validate Error: System.InvalidOperationException : The XmlSchemaSet on the document is either null or has no schemas in it -