Can anyone help me ?
-
I wanna know how to add an item to a combobox from a textbox by clicking a button. I usually use C# so i'd prefer to finish what i'm doing in C#. thanx.
Won't
myNiftyComboBox.Items.Add(myVerySpecialTextBox.Text);
do the trick? Regards, MattIt isn't enough to do well in life. One must do good when and where one can. Otherwise, what's the point?
-
I wanna know how to add an item to a combobox from a textbox by clicking a button. I usually use C# so i'd prefer to finish what i'm doing in C#. thanx.
-
Won't
myNiftyComboBox.Items.Add(myVerySpecialTextBox.Text);
do the trick? Regards, MattIt isn't enough to do well in life. One must do good when and where one can. Otherwise, what's the point?
-
that worked but when i open the program i add an item, if i restart the program the new item isn't there anymore...
There may be other ways, but here's what I would do: - Create a Serializable class with an array of strings as a member. - When you close your application, create an instance of this class and copy your comboBox items into the string array of your class. - Then, serialize your class in to file. Finally, when you start your application, deserialize your class, and use
comboBox1.Items.Clear(); comboBox1.Items.AddRange(myCustomClassInstance.StringArray);
You will find plenty of information and tutorials about serialization on the web. Cheers