Learning Targets: Develop code blocks that use arithmetic operations Develop programs that use...

20
Learning Targets: Develop code blocks that use arithmetic operations Develop programs that use subtotals and final totals 1

Transcript of Learning Targets: Develop code blocks that use arithmetic operations Develop programs that use...

Page 1: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

• Learning Targets: Develop code blocks that use arithmetic

operations Develop programs that use subtotals

and final totals

1

Page 2: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

• First open up Visual Basic.

• Then go to File, New, Project.

• Next click Window Application. Then name the project Score Board. Check the create directory for solution box. Press OK.

REMEMBER TO SAVE TO YOUR

(H:) DRIVE!

2

Page 3: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

• First go to the properties window and change the size to 512, 368.

• Get 2 Labels, 3 Text Boxes, and 10 Buttons.

• Remember you can design the form to how you want it to look!

3

Page 4: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

• To name a button go to the Properties Window.

• Then go to Text and make 2 touchdown buttons, 2 field goal buttons, 2 safety/ field goal, 2 Convert buttons, 1 Quarter button, and 1 End of Game button.

4

Page 5: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

• This is very simple. Go to the Properties Window and go to text (like with buttons).

• Then in the Properties Window go to Font and change to your liking!

5

Page 6: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

• Go to the Properties Window and change the text to 0 on the text boxes that are going to be used for the home and away score.

• Change the text to 1 for the text box that will be used for quarters.

6

Page 7: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

• Centering a text box is easy!

• Go to the Properties Window and go to Text Align to center.

7

Page 8: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

Naming Buttons and Text Boxes

• Go to the Properties Window and go to name.

• Then if your creating a button type btn(nameofbutton).

• If it’s a text box type the name as txt(nameoftext).

8

Page 9: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

Setup your Form to your liking and lets get to coding!

• Just set a layout of your buttons, labels, and text boxes so that they can be easily read by someone else.

9

Page 10: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

• Double click the Touchdown Button assigned to the home team.

• Then type the code as txt(name of the home team textbox).Text = txt(name of same text box).Text + 6

10

Page 11: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

Getting Back to the Form

• There are two tabs at the top of the screen.

• To get back to the form simply press Form1.vb [Design]

11

Page 12: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

Coding Cont.

• Do the same thing for the visitor button for touchdowns.

• The code for it is txt(name of visitor text box).Text = txt(name of same text box).Text + 6

12

Page 13: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

• Double click the button assigned for field goals for the home team.

• The code is txt(name of home team text box).Text = txt(same text box).Text + 3

13

Page 14: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

Field Goal Coding Cont.

• Double click the visitor’s field goal button.

• The code is txt(name of visitor text box).Text = txt(same text box).Text + 3

14

Page 15: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

Safety/Two Point Conversion Coding

• Double click the home team’s Safety/Two point button.

• The code is txt(home team text box).Text = txt(home team text box).Text + 2

15

Page 16: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

Safety/Two Point Conversion Cont.

• Double click the Safety/Two point conversion button.

• The code is txt(vistor text box).Text = txt(visitor text box).Text + 2

16

Page 17: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

Convert Button

• Double Click the Convert Button.

• The code is txt(Home text box).Text = txt(home text box).Text + 1

• Visitor code is txt(away text box).Text = txt(away text box).Text + 1

17

Page 18: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

Making Reset Button

• Double click the end game button

• The code is

18

Page 19: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

Making The Quarter Button

• Double click the Quarter button.

• The code is

19

Page 20: Learning Targets:  Develop code blocks that use arithmetic operations  Develop programs that use subtotals and final totals 1.

Creating a Background!

• Go on the internet and find a picture you want as the background of your score board.

• Right click image and save to computer.

• Then go to BackgroundImage and select your image.

20