Week
6
Run 6-1 to understand procedures at home
Tutorial 6-2 page 355-360 “Test Average”
In lab copy and paste form1.vb from 2008 source code to 2003 new project named Test Average 2003. This is so your 2008 code will work in your 2003 software. The bold section is the new code you add to your program.
Remember
to check your homework section. You need to see the videos from the book and
review quizzes.
Comment
code from 2008 that will not work with 2003: eg.
‘Me.btnExit.UseVisualStyleBackColor = False
And comment code that does not work with 2003 version of Visual
Basic with compiling. It is usually the code that has the function UseVisuallyStyleBackColor
Tutorial
6-7 page 391 Building the Bagel House Application
Create a new Visual Basic Application called Bagel House
Remember to use Save All when working. If you don’t use it your
files will not be saved correctly.
You can find the form already made with the GUI at this link:
You can either copy and paste the code to your Form1.vb or right
click your mouse à Save Target as à and replace it with your
Form1.vb
http://web.eng.fiu.edu/sminer/cop3175/programs/week6_form/Bagel
House/Form1.vb
or
http://www.cis.fiu.edu/~sbarrera/COP3175_Fall2008/Form1.vb
from: http://web.eng.fiu.edu/sminer
Tips: Some students had difficulties getting started because:
a.
They started at page 392 instead of 391. So they
skipped creating a global constant variable:
Const decTAX_RATE As
Decimal = 0.06D ‘Sales tax rate
Where do you put this variable? You put it
outside the functions and inside the class. Usually at the
top of your code.
b.
Students did not close the GUI code. They continued
working with the GUI code as -. Therefore, they started getting confused and
overwhelmed. Students need to close the – signs to + so they see the least
amount of code. Then only look at the code that they are working on. They will
not be working with the GUI code from View Code, but instead work with the GUI
code from the properties box of each GUI control.
c.
Students did not know where to put the functions. Functions
are located anywhere, but ideally put them at the end. Make sure to put the
functions before end class; otherwise, the program will become corrupted. All
programs are inside a class.
d.
Code in Step 4 such as ResetBagels( ) should be
commented until used. So, once The code for ResetBagels
() exists then you can use the function ResetBagels( ) inside the subprocedure Provate Sub btnReset_Click …etc.
e.
Variables such as radWhite
were red because they were not declared. To declare them, go back to page 382
and look at the image. Match the radWhite label variable
name with the label text name, White ($1.25). Look at the properties box of
your control where White ($1.25) is being used. In the design section, put radWhite. Notice that variables are recognized as they are
declared correctly. Then variables can be used.