create a program to order pizza. VB 6.0
Form
3 option buttons 3 Check buttons
Size Toppings
Small ($5.00) Extra Sausage ($0.50)
Medium ($8.00) Anchives ($0.50)
Large ($12.00) Extra Cheese ($0.50)
1 submit button
1 new order button
enter order button
output box picture box
Your Order is
size pizza = XXXXXX
toppings = xxxxx
what toppings were ordered = xxxx
toal = xxxx |
Request for Question Clarification by
mathtalk-ga
on
14 Dec 2002 15:25 PST
Hi, begentle-ga:
I'm a little uncertain about the functionality of the "submit" button
versus the "enter order" button. Would you explain how these are
different or related?
Also, you describe the output box as (in part) a picture box. In
terms of the scope of this question, what did you have in mind? If
the desire is to display a picture of the (single) pizza ordered,
would a "placeholder" be acceptable? If not, how much detail in the
image is desired, eg. getting the size right versus showing the
Sausage and Anchovies (sp?).
thanks in advance from a pizza lover,
mathtalk-ga
|
Clarification of Question by
begentle-ga
on
14 Dec 2002 15:49 PST
Here is what I know, write a program to order a pizza by filling out a
form. Users can select toppings by clicking on check boxes next to
the toppings' names. They can also click on a button to select a
small, medium, or large pizza (but they can only select one item from
that category). Display prices for each size pizza. When the user
has completed the form by clicking a submit button, figure out how
much the pizza costs if toppings are 50 cents each. Display the total
amount due to the user in some sort of message box or on the form (it
says be creative!yea right!) Allow the user to continue using the
program until they click an exit button. Insert commetns in the
program to document the program internally.
thanks in advance from a another pizza lover,
mathtalk-ga
|
Request for Question Clarification by
mathtalk-ga
on
16 Dec 2002 09:41 PST
Hi, begentle-ga:
I've created a VB 6.0 project to implement this application, and I
would like to know what your timeframe is for this mini-project. It's
often a good idea, unless your timeframe is indefinite, to give an
explicit deadline so that researchers will know when a reply would no
longer be useful.
regards, mathtalk-ga
|
Hi, begentle:
I have completed your application and am working on loading it to a
mutually accessible site on the Web so that you can download it.
Due to the fact that another researcher had this question locked for a
period of time, I will begin by posting a brief explanation of my
methods in developing the application.
I opened a new "Standard EXE" project in Microsoft Visual Basic 6.0
(sp5). On the default "Form1" that was created for me, I add the
necessary labels and controls that you will see there. The basics of
the user interface on this single form were therefore created without
writing any code at all.
The most interesting aspect of this process was the buttons for the
"mutually exclusive" options for pizza size. To implement this in the
most "natural" way one uses a "control array" of "Option" buttons,
also known as "radio buttons".
There are several ways to accomplish this; I used the cut-and-paste
method. That is, I used the "tools" palatte to create the first
option button (the round button with a dot in the middle). I pasted
this onto the form in the selected position and assigned its Caption
property to be "Small ($5.00)" in accordance with the brief
specifications you gave above.
I then selected the entire button control on the form, and did a
"copy" with Ctrl-C, followed by Ctrl-V to paste. This caused the VB
IDE to prompt me, asking if I intended to create a control array. I
answered in the affirmative, which means that syntax for the existing
control and the new copy were made to reflect an "array-like" name.
The original button became Option1(0) instead of simply Option1, and
the new button became Option1(1). I pasted a third copy, which is now
Option1(2), and changed the Caption properties of both the copies to
reflect the Medium and Large size options.
I used check boxes to implement the choices for extra toppings, as
these are not mutually exclusive.
I created three Command Buttons along the bottom of the form. At this
point I was prepared to do some programming for the application,
so-called "code behind forms".
The first command button has a "Clear" label, and I wrote code which
simply resets the Value property of each non-command button to "false"
or zero, as the case may be.
The second command button has a "Submit" label, and I wrote code which
constructs a string describing the order placed, the cost of extra
toppings, and the total cost of the order. To add a note of
creativity, I have a line there about waiting for the "delicious
pizza" to be prepared. The prompt then appears in a modal message
box.
The third command button has an "Exit" label, and I wrote code which
unloads the form and ends the application.
I will post a clarification with the location of these projects files
(zipped together) within the next two hours.
regards, mathtalk-ga |
Clarification of Answer by
mathtalk-ga
on
18 Dec 2002 16:00 PST
Hi, begentle:
I zipped up the project files for this application and placed the
resulting on the Web at:
http://www.lucidmatrix.com/uploads/begentle.ZIP
Please download the file as soon as possible so that we can resolve
any questions you have about how the program works or meets your
specifications.
regards, mathtalk-ga
|
Clarification of Answer by
mathtalk-ga
on
19 Dec 2002 11:57 PST
Hi, begentle-ga:
Thanks for the kind words in your recent comment! Did, perhaps, you
mean to post this as a rating/comment? I'm not familiar with the
interface from an asker's point of view, so I can't judge if this is
likely to be what you intended.
It was a pleasure working with you.
regards, mathtalk-ga
|
Clarification of Answer by
mathtalk-ga
on
22 Dec 2002 10:35 PST
Hi, begentle:
I've added the picture box and TOTAL button as requested, to display
the combined costs of pizza size and toppings. I tweaked a few
things, like giving "Active Pizza Institute" as the caption of the
main form. In updating the file link on the Web, I included the .EXE
build to expedite your testing:
http://www.lucidmatrix.com/uploads/begentle.ZIP
Here's a quick synopsis of my steps. I moved the existing button
controls around to make a little room on the form. I needed to widen
the form in any case to place the picture box, which is Picture1, on
the right side of the form.
I put another command button (Command4, if you're counting)
underneath, with a caption "TOTAL". The code for Command4_Click makes
use of the .Print method and (to get things to line up well) the
.CurrentX and .CurrentY properties to align the text output.
Thanks for being patient with me. I truly didn't understand that both
a picture box and a message box were required; I thought it was an
either/or situation.
regards, mathtalk-ga
|
Clarification of Answer by
mathtalk-ga
on
22 Dec 2002 10:39 PST
Oh, one other point before I forget it. In design mode, when I added
the picture box control, I set the AutoDraw property to True. This
allows the text output to the screen to be "drawn" to an image in
memory at the same time, so that when the picture box's display is
refreshed, it is refreshed from memory (because the text output
instructions are no longer "around" to RePaint the control).
regards, mathtalk-ga
|
Clarification of Answer by
mathtalk-ga
on
01 Jan 2003 11:35 PST
Hi, begentle-ga:
1) Did you download that updated project and unpack the files?
2) Did you try to run begentle.exe? I am talking about the executable
program, begentle.exe, included in the last .zip file that I posted
for you. Run it from the commandline, or double click on it from
within Windows Explorer. (This doesn't require Visual Studio; the
program is a Windows executable.) What happens when you do that?
3) Did you fix the line that you wrote, "AutoRedraw -1 'True". This
is incorrect syntax, not part of the project that I sent you. The way
I set the AutoRedraw property of Picture1 is in "design mode", not in
code. That would be the best approach, if you are retracing my steps.
If you prefer to do something like this in code, you will have to use
the correct syntax:
Let Picture1.AutoRedraw = True
So here is the order of steps to take. Answer the questions outlined
above; this should just take a few minutes and help tremendously
clarify what you have tried to do.
Then fix the syntax error on that AutoRedraw line. Again, the
simplest thing is simply to remove the line (or comment it out, if you
wish to keep a placeholder for some reason).
Do these steps and I will be watching for your reply.
regards, mathtalk
|