Google Answers Logo
View Question
 
Q: programing ( Answered 5 out of 5 stars,   22 Comments )
Question  
Subject: programing
Category: Computers > Programming
Asked by: begentle-ga
List Price: $20.00
Posted: 14 Dec 2002 11:15 PST
Expires: 13 Jan 2003 11:15 PST
Question ID: 124640
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
Answer  
Subject: Re: programing
Answered By: mathtalk-ga on 18 Dec 2002 14:44 PST
Rated:5 out of 5 stars
 
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
begentle-ga rated this answer:5 out of 5 stars and gave an additional tip of: $20.00
The answer was great and very well executed!  I did not know you could
tip how wonderful.  Thanks again mathtalk for you help and comments.

Comments  
Subject: Re: programing
From: jeanluis-ga on 14 Dec 2002 15:16 PST
 
What is the difference between the enter order button and the submit button?
Subject: Re: programing
From: begentle-ga on 16 Dec 2002 15:48 PST
 
I would need to have it by Wednesday.  Let me know what you think I
found a VB web site wtih a project very much like this one.
http://www.internet.com/msbooks/vbstepbystep.html
Event-Driven Programming
Subject: Re: programing
From: mathtalk-ga on 16 Dec 2002 20:58 PST
 
Hi, begentle-ga:

That is a similar theme, if not as complex.  In your specification
there is one simplifying feature, that the event driven aspect is
really limited to the button clicks (for submit, exit, etc.).

I think I can knock this out for you tomorrow morning (Tuesday).  I'm
thinking about posting a sketch of my steps to build the application,
and zip up the project files and post them for you on the Web.  Will
that work for you?

regards, mathtalk-ga
Subject: Re: programing
From: begentle-ga on 19 Dec 2002 11:43 PST
 
Your work has exceed the pay and I am sorry I could not post more. 
Thank you for all you effort and work.  Your a scholar!!
Subject: Re: programing
From: begentle-ga on 20 Dec 2002 10:15 PST
 
Your so right I did mean to enter that in the rating section.  I am
still working with the material.  This is a great way for me to
practice and since I am off this week I can work at it.  Thanks again
and it was a pleasure working with you also.  Hopefull I can make it
work!
begentle-ga
Subject: Re: programing
From: begentle-ga on 20 Dec 2002 12:57 PST
 
they is no total button?
Subject: Re: programing
From: mathtalk-ga on 20 Dec 2002 15:57 PST
 
Hi, begentle:

I thought the total figure (indicated in your original answer)
represented the total of the basic "size" of pizza plus the cost of
toppings.  If you mentioned a "total button", I missed that.  As far
as orders go, I considered each pizza a separate order; were you
aiming to keep a running total (of all pizza orders submitted)?

regards, mathtalk-ga
Subject: Re: programing
From: begentle-ga on 21 Dec 2002 09:54 PST
 
Iam sorry since I am new at this I may not have made myself clear. 
The total should be insdie the form, as a pic box so that when you hit
submit the total appears just like your external box does that make
sense?   I believe a pic.out.print?  Total should be:
Pizza     $8.00
Toppings  $1.50
Total     $9.50
Subject: Re: programing
From: mathtalk-ga on 21 Dec 2002 10:25 PST
 
I think I understand.  You want a "total" button that shows cost,
prior to "submitting" the order, and you want the given text formatted
on the form (rather than in the message box, as previously mentioned).
 I'll be glad to make the additional change for you.

BTW, I think there is a "request clarification" button next to the
Answer, that you can use to ask for these sorts of follow-ups.  Google
Answers sends me an email about any such requests, which might be a
bit more reliable (for future reference) than relying on my noticing
the additional comments.

regards, mathtalk-ga
Subject: Re: programing
From: begentle-ga on 23 Dec 2002 14:17 PST
 
Yes the total should appear inside the form with total just like your message   box.
Subject: Re: programing
From: mathtalk-ga on 23 Dec 2002 16:22 PST
 
Hi, begentle:

Check out the recent clarifications to my answer (above the comments).
 I have updated the application to reflect the "total inside the
picture box" spec.

Please take a quick look; I included the .exe in the zip file this
time.

regards, mathtalk-ga
Subject: Re: programing
From: begentle-ga on 30 Dec 2002 20:32 PST
 
I have not had a chace to try until today I am getting 
compile error 
syntax
This happens on Attribute.
I also can not do 
AutoRedraw -1 'True
My version does not have that feature.
For my level of program this my be to completed.
What do you think?
Subject: Re: programing
From: mathtalk-ga on 30 Dec 2002 20:49 PST
 
Hi, begentle-ga:

Let me ask a few questions to better understand what difficulty you
are having.

Are you able to run the executable I sent?

In trying to compile, you say you are getting a syntax error on
"Attribute".  Is this related to your next comment:

I also can not do  
AutoRedraw -1 'True 

Please explain what is meant by the syntax error, e.g. what line in
what routine do you get a syntax error on?

Note that the AutoRedraw property of the Picture Box is set at design
time, and is never referenced in the Visual Basic code.  After placing
the Picture Box on the form, I used the "drop list" next to the
AutoRedraw entry in the Properties window (for control Picture1) to
set this property to True.

Please give what version of Visual Basic you are working with, since
you say your "version does not have this feature."  I can't make out
what you are saying about "my level of program" and "to be completed."
 I was working with Visual Basic 6.0 under Windows 98 to develop the
program.  Let's figure out what version of software you have, and
eliminate any incompatibility there.  I also have NT, 2000, and XP
that I could test with.

regards, mathtalk-ga
Subject: Re: programing
From: begentle-ga on 31 Dec 2002 08:37 PST
 
Problem 1
What the phase Attribute VB_Name ="Form1"
then try to use run and start the error 
message that comes up is 
compile error
syntax error

Problem 2 
Autodraw on VB6.0 that is running on Windows 98 only has true or false
it I can not type -1, the '.

I have check what I have done and am lost.
Subject: Re: programing
From: mathtalk-ga on 31 Dec 2002 09:55 PST
 
On problem 2: You want to set AutoRedraw to True in the Property
window.  Do not type anything. Just use the drop list next to
AutoRedraw for Picture1 and select True.  This was already done in the
last project I sent you, so unless you are duplicating my work, it
doesn't need to be done again.

On problem 1: I cannot parse your statement.  Please try to explain to
me again what you are doing and what happens.  I sent you a completed
program, but you have not said whether it works for you or not.  If
you are making changes to the earlier project to duplicate the changes
I made, you should follow my steps carefully.  Perhaps you would want
to send your project to me for debugging, but I think this is outside
the scope of the original question.  Without knowing what, if
anything, is not working for you
Subject: Re: programing
From: mathtalk-ga on 31 Dec 2002 09:57 PST
 
I cannot make a constructive suggestion.

regards, mathtalk
Subject: Re: programing
From: mathtalk-ga on 31 Dec 2002 13:39 PST
 
Just to clarify (the text got broken in two in my last comments):

Without knowing the details of what it is that is not working (that
causes the compiler/syntax error), I cannot make a constructive
suggestion.

Apparently you are getting a syntax error on a line, possibly the same
one disucssed as problem 2.  As I said, there should not be any VB
code such as you have written, concerning AutoRedraw.  So perhaps
after that line is removed, the compiler problem will go away.

At any rate fix problem 2.  Remove that line of code.  Check that the
AutoRedraw property is properly set (to True) in the Properties for
Picture1.

Note that in the future there is no guarantee that True will be
equivalent to -1.  This sort of VB idiosyncrasy will disappear in the
VB.Net environment for the sake of compatibility with other languages.

regards, mathtalk-ga
Subject: Re: programing
From: begentle-ga on 01 Jan 2003 10:35 PST
 
No it does not work how can it run if it has a compile error, and a syntax error.
I don't know how else to say it and I am running out of time.
Subject: Re: programing
From: mathtalk-ga on 01 Jan 2003 11:41 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
Subject: Re: programing
From: begentle-ga on 01 Jan 2003 13:50 PST
 
I just got this I will try and get back to you
Subject: Re: programing
From: begentle-ga on 01 Jan 2003 14:24 PST
 
Well I found out what was wrong it was not you or me.  My computer
crashed the other day so I uninstalled VB and reinstalled it and tried
another program I had and it worked.  The pizza one works also thanks
again for your patience and help.
Subject: Re: programing
From: mathtalk-ga on 01 Jan 2003 18:00 PST
 
The progress is good news!  I am on SP5 of Visual Studio.  This stuff
we are doing is pretty "vanilla", but you never know if something
might be useful in a service pack.  Since you reinstalled Visual
Basic, it might be a good idea to at least check the service pack
level and perhaps to bring it up to at least the SP5 that I'm running.

regards, mathtalk-ga

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy