06-27-2007, 07:44 AM
I'm just beginning to learn VB, but I need to write a program that calculates the total cost of building a PC for my class but I'm not sure how to go about it.
The basic design is that you pick the parts from each dropdown box, (CPU, mboo, hdd, ram, etc) and the application will calculate the total cost of the parts.
I know this is a very basic question, but I can't seem to find any examples of what I am trying to do and we haven't covered this in class.
Any Help would be greatly appreciated!
06-27-2007, 08:41 AM
Since you're doing this for a class, I can tell you the WHAT, but not the how.
WHAT you need to do is populate each dropdown box, and either include the price of each item in the dropdown list, then split the string in your code and do the math with the part of the string that contains the price, or, in your code assign a price to each item behind the scenes.
I hope this helps. Just brute-force your way through it.
I will help you if you have specific questions on how to do a PIECE of this, but the work needs to be your own.
06-27-2007, 09:48 AM
Welcome to the forum!
You will find everyone will help you as you go along with your project.
You should begin by just taking some paper and sketch your GUI, and list the program objectives. It doesn’t have to be pretty, but it is very useful for getting you thinking ahead of actually putting down code.
Second, create your new project and GUI. Include all the controls you sketch has. Name all controls/forms appropriately from the start, not later on.
Next, populate your drop-down lists, and declare/instantiate all variables you will need. <Hint> This should could occur when your project loads.
Once you begin to start typing code, if you get stuck on code, or just plain want advice, please post and you will get an answer.
07-01-2007, 01:29 AM
Ok I've found some examples and have figured out how to get my project rolling, but I'm stuck on the output. I want to have multiple things output to a text box such as the wholesale cost, tax, labor, total cost, etc.
How do you put multiple variables into a text box?
07-01-2007, 09:12 AM
Do you have a textbook or something and suggested readings? I mention this because information on string concatenation (here's a hint that is what you want to know about here) is usually within the first three chapters of any programming book, since getting output is pretty tough without it. Additionally, I know it's usually rare for a class to require you to use information that the text or lectures don't make available.
Once you see a few concatenation examples I think it will be obvious what needs to be done.