Skip Navigation LinksMicrosoftSmallBasicProgrammingReferenceGuideTableOfContents

 Developer's Reference Guide to Microsoft Small Basic
Table of Contents
 
 

INTRODUCTION

 

1. Introducing Small Basic

Preview 1-1
Introducing Guide to Small Basic 1-2
Requirements for Guide to Small Basic 1-3
Introducing Small Basic 1-4
Starting Small Basic 1-5
Running a Small Basic Program 1-7
Chapter Review 1-11

2. Overview of Small Basic Programming

Preview 2-1
A Brief History of BASIC 2-2
Variables 2-3
Small Basic Data Types 2-4
Arrays 2-5
Intellisense Feature 2-6
Small Basic Statements and Expressions 2-7
Small Basic Arithmetic Operators 2-8
Comparison and Logical Operators 2-9
Concatenation Operator 2-10
Math Functions 2-11
Random Numbers 2-13
Small Basic Decisions - If Statements 2-14
Small Basic Looping 2-17
Small Basic Counting 2-21
Small Basic Subroutines 2-23
Small Basic Objects 2-25
Chapter Review 2-27

Small Basic Objects

3. Program Object

Preview 3-1
Program Object 3-2
Program Properties 3-2
Program Methods 3-2
Example 3-1. Program Directory 3-3
Example 3-2. Program Delay 3-4
Program End Method 3-5
Example 3-3. Program End 3-6
Chapter Review 3-7

4. TextWindow Object

Preview 4-1
TextWindow Object 4-2
TextWindow Properties 4-2
TextWindow Methods 4-3
TextWindow Features 4-4
Example 4-1. TextWindow Properties 4-6
TextWindow Input 4-7
Example 4-2. TextWindow Input 4-8
TextWindow Output 4-11
Example 4-3. Dice Rolling (TextWindow Output) 4-12
Chapter Review 4-14

5. GraphicsWindow Object

Preview 5-1
GraphicsWindow Object 5-2
GraphicsWindow Coordinates 5-2
GraphicsWindow Properties 5-3
GraphicsWindow Methods 5-5
GraphicsWindow Events 5-7
GraphicsWindow Features 5-8
GraphicsWindow Colors 5-10
GraphicsWindow Font 5-11
Example 5-1. GraphicsWindow Properties 5-12
Example 5-2. SetPixel Method 5-13
Example 5-3. DrawLine Method 5-14
Example 5-4. Drawing Rectangles 5-16
Example 5-5. Drawing Ellipses 5-17
Example 5-6. Drawing Triangles 5-18
Chapter Review 5-19

6. Controls Object

Preview 6-1
Graphic User Interface (GUI) 6-2
Button Control 6-4
Button Properties 6-4
Button Methods 6-4
Button Events 6-4
Example 6-1. Change Window Color 6-6
Example 6-2. Change Button Caption 6-8
Example 6-3. Hide/Show Buttons 6-10
TextBox Control 6-12
TextBox Properties 6-12
TextBox Methods 6-12
TextBox Events 6-13
Example 6-4. Random Numbers 6-14
Example 6-5. Guess the Number 6-16
Example 6-6. Tray Problem 6-19
Chapter Review 6-22

7. Clock Object

Preview 7-1
Clock Object 7-2
Clock Properties 7-2
Example 7-1. System Time/Date 7-3
Example 7-2. Stopwatch 7-5
Chapter Review 7-7

8. Text Object

Preview 8-1
Text Object 8-2
Text Methods 8-2
Using Text Methods 8-4
KeyDown Event 8-7
Example 8-1. Character Codes 8-10
Example 8-2. Encode/Decode 8-12
Chapter Review 8-14

9. ImageList Object

Preview 9-1
ImageList Object 9-2
ImageList Methods 9-2
Loading Image Files 9-3
Displaying Images 9-4
Example 9-1. Image Display 9-5
Example 9-2. Resized Image Display 9-10
MouseDown Event 9-15
Example 9-3. MouseDown Event 9-16
Example 9-4. Find the Burger Game 9-18
Example 9-5. Tic-Tac-Toe Game 9-21
Chapter Review 9-28

10. Shapes Object

Preview 10-1
Shapes Object 10-2
Shapes Methods 10-2
Lines 10-4
Example 10-1. Line 10-5
Rectangles, Ellipses, Triangles 10-6
Example 10-2. Rectangle, Ellipse, Triangle 10-7
Text 10-9
Example 10-3. Text 10-11
Images 10-13
Example 10-4. Image 10-14
Move Method 10-16
Example 10-5. Random Burger 10-17
Rotate Method 10-19
Example 10-6. Random, Rotating Burger 10-22
Animate Method 10-24
Example 10-7. Stacking Boxes 10-25
Chapter Review 10-28

11. Mouse Object

Preview 11-1
Mouse Object 11-2
Mouse Properties 11-2
Mouse Methods 11-2
Use of Mouse Object 11-3
MouseDown Event 11-4
Example 11-1. MouseDown Example 11-5
MouseMove Event 11-7
Example 11-2. MouseMove Example 11-8
MouseUp Event 11-10
Example 11-3. MouseUp Example 11-11
Example 11-4. Drawing Program 11-13
Chapter Review 11-16

12. Timer Object

Preview 12-1
Timer Object 12-2
Timer Properties 12-2
Timer Methods 12-2
Timer Events 12-2
Use of Timer Object 12-3
Example 12-1. Timer Example 12-4
Example 12-2. Ellipse Example 12-6
Example 12-3. Calendar Display 12-9
Example 12-4. Dice Rolling 12-11
Timer Object for Delays 12-14
Example 12-5. Display Delay 12-15
Example 12-6. Animated Find the Burger Game 12-19
Chapter Review 12-24

13. Sound Object

Preview 13-1
Sound Object 13-2
Sound Methods 13-2
Built-In Sounds 13-3
Example 13-1. Built-In Sounds 13-4
Playing Other Sounds 13-6
Example 13-2. Playing Sounds 13-7
Chapter Review 13-9

14. File Object

Preview 14-1
File Object 14-2
File Properties 14-2
File Methods 14-2
Sequential Files 14-4
Sequential File Output 14-6
Example 14-1. Sequential File Output 14-7
Sequential File Input 14-6
Example 14-2. Sequential File Input 14-7
CSV (Comma Separated Values) Files 14-12
Example 14-3. CSV Data Files 14-14
Writing and Reading Text Using Sequential Files 14-19
Configuration Files 14-21
Example 14-4. Configuration Files 14-23
File Directory 14-26
Example 14-5. File Directory 14-27
Locating Files 14-30
Example 14-6. Locating Files 14-31
Chapter Review 14-33

Other Topics

15. Debugging a Small Basic Program

Preview 15-1

16. Input Validation

Preview 16-1
Text Box Input Validation 16-2
Date Validation 16-4
Example 16-1. Date Validation 16-5
Numeric Validation 16-10
Example 16-2. Numeric Validation 16-11
Chapter Review 16-15

17. Date Arithmetic

Preview 17-1
Subtracting Dates 17-2
Example 17-1. Subtracting Dates 17-5
Chapter Review 17-10

18. Shuffling Integers

Preview 18-1
Shuffling Integers 18-2
Example 18-1. Shuffling Integers 18-4
Displaying Playing Cards 18-6
Example 18-2. Displaying Playing Cards 18-9
Example 18-3. Video Poker 18-11
Chapter Review 18-17

19. Line, Bar and Pie Charts

Preview 19-1
Line Charts and Bar Charts 19-2
Coordinate Conversions 19-5
Drawing a Line Chart 19-8
Example 19-1. Mariners Attendance Line Chart 19-10
Axis Labeling 19-13
Example 19-2. Y Axis Labeling 19-17
Example 19-3. X Axis Labeling 19-19
Plot Labeling 19-22
Example 19-4. Plot Labeling 19-23
Drawing a Bar Chart 19-29
Example 19-5. Mariners Attendance Bar Chart 19-31
Bar Chart X Axis Labeling 19-37
Example 19-6. Bar Chart X Axis Labeling 19-37
Example 19-7. Seattle Rainfall Bar Chart 19-41
Pie Charts 19-44
Example 19-8. Drawing a Pie Segment 19-47
Drawing a Pie Chart 19-49
Example 19-9. Seattle Rainfall Pie Chart 19-50
Pie Chart Labeling 19-53
Example 19-10. Pie Chart Labeling 19-54
Chapter Review 19-58

20. Animation

Preview 20-1
Animation with Small Basic 20-2
Example 20-1. Dropping Ball 20-4
Border Crossing 20-7
Example 20-2. Scrolling Ball 20-9
Border Intersection 20-11
Example 20-3. Bouncing Ball 20-12
Example 20-4. Bouncing Ball with Sound 20-16
Example 20-5. Two Bouncing Balls 20-18
Collision Detection 20-22
Example 20-6. Two Colliding Balls 20-25
Example 20-7. Bouncing Ball with Paddle 20-29
Example 20-8. The Original Video Game – Pong! 20-34
Chapter Review 20-40

21. Check Box and Radio Button Controls

Preview 21-1
Check Box Controls 21-2
Example 21-1. Create Check Box Group 21-5
Clicking a Check Box 21-7
Example 21-2. Clicking Check Boxes 21-9
Radio Button Controls 21-12
Example 21-3. Create Radio Button Group 21-16
Clicking a Radio Button 21-18
Example 21-4. Clicking Radio Buttons 21-19
Example 21-5. Pizza Ordering 21-22
Chapter Review 21-27

22. Turtle Graphics

Preview 22-1
Turtle Object 22-2
Turtle Properties 22-2
Turtle Methods 22-3
Example 22-1. Draw a Square 22-4
Example 22-2. Draw a Polygon 22-6
Example 22-3. Draw Multi-Colored Circles 22-10
Other Turtle Graphics 22-12
Example 22-4. Draw a Flower 22-13
Example 22-5. Draw a Pinwheel 22-16
Example 22-6. Draw a Spiral Effect 22-18
Chapter Review 22-20

23. Flickr Photos

Preview 23-1
Flickr Class 23-2
Flickr Methods 23-2
Example 23-1. Picture of the Moment 23-3
Example 23-2. Tagged Picture 23-6
Chapter Review 23-10

24. Dictionary

Preview 24-1
Dictionary Class 24-2
Dictionary Methods 24-2
Example 24-1. Word Definition 24-3
Chapter Review 24-5

25. Sharing a Small Basic Program

Preview 25-1
Sharing a Program 25-2
Publishing a Program 25-5
Importing a Program 25-9
Chapter Review 25-10

Appendix I. Small Basic Colors