Click here to Skip to main content
15,912,756 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I am developing a software which helps in billing and maintain sales details.
You know that companies keep on adding as time goes by.
I thought of creating a button for adding new company name and name of its products.
The problem is I could not find a way to store the details.
For example:
If I get distribution of a company X with products name A,B &C,the button I have created should input the name of the company and its product's name.
The name of the company should appear as radio button.
If I click on that radio button and click next on that form,in a new form a combo box should be displayed.When I click on the combobox,drop down of the names of the products should be displayed in the combobox.
Please let me know how to do so?
Is there any way to update the form using some buttons as mentioned above after creating a project?

[edit]SHOUTING removed - OriginalGriff[/edit]
Posted
Updated 2-Feb-13 4:53am
v2
Comments
OriginalGriff 2-Feb-13 10:55am    
DON'T SHOUT. Using all capitals is considered shouting on the internet, and rude (using all lower case is considered childish). Use proper capitalisation if you want to be taken seriously.

By the way: it would also be polite to try and summarize your problem in the subject "HOW TO DO THIS?" is not descriptive, and does not tell anyone what your problem might be, and if they have any knowledge of the subject.

As I said when you asked this last time: you need to store this in a file or in the applications settings and reload them when you open the application.

If you have a specific problem with how to do that, ask about it, but don't ask a general questions and expect a detailed answer.


"What do you mean by storing in a file or application settings?
How to do that?"


To store them in a file is pretty easy. If you want to add three companies - IBM, Dell and Acer say, then all you have to do is put them into an array of strings:
VB
Private Sub saveCompanies()
	Dim company1 As String = "IBM"
	Dim company2 As String = "Dell"
	Dim company3 As String = "Acer"
	Dim companies As String() = New String(2) {}
	companies(0) = company1
	companies(1) = company2
	companies(2) = company3
	File.WriteAllLines("D:\Temp\MyCompanies.txt", companies)
End Sub
Private Sub loadCompanies()
	Dim companies As String() = File.ReadAllLines("D:\Temp\MyCompanies.txt")
	For Each company As String In companies
		Console.WriteLine(company)
	Next
End Sub
Obviously, most of that code is just setting up the data - you would probably use a List of strings and add them as you create the controls. You can then use the List directly to save the names in the file instead of an array as I showed.
When you read them out, you create your controls using pretty much the code you have already, just taking each name as it comes in turn instead of writing it to the console.

To do it via the program settings is a little harder, but not a lot - try it with a file first!
 
Share this answer
 
v3
Comments
sriramgn 2-Feb-13 11:07am    
What do you mean by storing in a file or application settings?
How to do that?
OriginalGriff 2-Feb-13 11:40am    
Answer updated
sriramgn 3-Feb-13 0:17am    
Thank you!
OriginalGriff 3-Feb-13 1:54am    
You're welcome!
Use application preferences I think it would be very easy than accessing from files
http://msdn.microsoft.com/en-us/magazine/cc163812.aspx[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900