| | |
Adding new item to combobox
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Dec 2008
Posts: 13
Reputation:
Solved Threads: 0
How can I add items programatically into combo box control during runtime?
I am trying like this.
expcombo.Items.Add(expcombo.Text); But given item is not saved. when I close the form and run the form again.. combo box is not showing that given item.
I changed above statement like this
Messagebox.show(expcombo.Items.Add(expcombo.Text));
Here I am getting a numeric value like 1 even though I entered string value.
Pls somebody help me. I am trying for this from long back
I am trying like this.
expcombo.Items.Add(expcombo.Text); But given item is not saved. when I close the form and run the form again.. combo box is not showing that given item.
I changed above statement like this
Messagebox.show(expcombo.Items.Add(expcombo.Text));
Here I am getting a numeric value like 1 even though I entered string value.
Pls somebody help me. I am trying for this from long back
Look, object (application, controls, textbox, combobox, etc...) data saved in machine memory, so when your application closed all its data removed.
To do your scenario, to add an item then close the application, and when you start it again, you find this item, you should have data repository (SQL Server, MySQL, XML, etc...) holds combobox items.
To do your scenario, to add an item then close the application, and when you start it again, you find this item, you should have data repository (SQL Server, MySQL, XML, etc...) holds combobox items.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
•
•
•
•
Messagebox.show(expcombo.Items.Add(expcombo.Text));
expcombo.Text is a property of the entire combobox, why do you want to show it as a selectable item in the combobox itself?
Last edited by ddanbe; Dec 26th, 2008 at 8:18 am.
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Make love, no war. Cave ab homine unius libri.
Danny
As RamyMahrous says, the items you add during runtime aren't saved anywhere. The items you put in during design are hardcoded and will always be there. The ones you add during runtime have to be saved by you before closing your app(many options here) and loaded back in when your app starts up.
Today is a gift, that's why it is called "The Present".
Make love, no war. Cave ab homine unius libri.
Danny
Make love, no war. Cave ab homine unius libri.
Danny
![]() |
Similar Threads
- add item from combobox to treeview (IT Professionals' Lounge)
- Source Code that don't work? (Java)
- Hey check out my prog. It has an error can u find it? (Java)
- Issue related to combobox.... (VB.NET)
- Need Urgent Solution (Visual Basic 4 / 5 / 6)
- JComboBox -- Item is not in the list???????? (Java)
- Can anybody please help me with this code? (ASP.NET)
- Adding controls into a ListView (Visual Basic 4 / 5 / 6)
Other Threads in the C# Forum
- Previous Thread: C# SendMessage to HTML document controls
- Next Thread: C# Custom GUI
| Thread Tools | Search this Thread |
.net access algorithm array barchart bitmap box broadcast c# check checkbox client combobox control conversion csharp custom cyclethruopenforms data database datagrid datagridview dataset date/time datetime degrees development dll draganddrop drawing encryption enum event excel file finalyearproject form format forms function gdi+ getoutlookcontactusinfcsvfile globalization httpwebrequest image index input install installer java label list listbox mandelbrot math mono mouseclick mysql operator panel path photoshop picturebox pixelinversion post programming radians regex remote remoting richtextbox save server silverlight sleep socket sql sql-server statistics stream string table text textbox thread time timer timespan update usercontrol users validate validation visualstudio webbrowser wia windows winforms wpf xml






