Click here to Skip to main content
12,889,934 members (49,453 online)
Rate this:
Please Sign up or sign in to vote.
See more: VB VB.NET
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 2-Feb-13 4:44am
Updated 2-Feb-13 4:53am
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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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:
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
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!
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!
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Use application preferences I think it would be very easy than accessing from files[^]

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

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170424.1 | Last Updated 3 Feb 2013
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100