Please use speaker notes for additional information! Settings in VB Please use speaker notes for additional information! This slide show deals with properties and settings used in Visual Basic.
Settings This slide shows the design of the form named frmSettings. Later slides will deal with the individual boxes and other entries.
TextBox This text box has a background color(BackColor) that was selected from the palette.
Settings The text that appears in txtBox2 has been entered under the property text.
Settings The box shown here is a picture box. It can be used to hold images or to hold other information. In this example, it will display text.
Settings This form includes a series of six buttons. The first button is labeled Blue by making the entry Blue under Caption.
Settings This shows the code that is attached to the buttons. To get here, I double clicked on the Blue button while it was in design mode. Note that the properties are for the cmdBlue button.
Private Sub cmdBlue_Click() txtBox1.BackColor = &HFF0000 End Sub Settings Option Explicit Private Sub cmdBlue_Click() txtBox1.BackColor = &HFF0000 End Sub Private Sub cmdCalc_Click() picPic1.Print 3 + 4 * 2 picPic1.Print 3 + (4 * 2) picPic1.Print picPic1.Print (3 + 4) * 2 Private Sub cmdExit_Click() End Private Sub cmdFond10_Click() txtBox2.Font.Size = 10 Private Sub cmdFont14_Click() txtBox2.Font.Size = 14 Private Sub cmdRed_Click() txtBox1.BackColor = &HFF When the Blue Command Button is clicked, then the BackColor property of txtBox1 is set to &HFF0000 which translates to blue. For details on the color code, see help or text. The Calculate Button displays information in the Picture box using .Print. First I am displaying 3 +4*2. Since multiplication is above addition in the hierarchy, the multiplication is done first giving 8 and then 3 is added giving 11. Because of the parenthesis in the second formula the multiplication is done first - without the parenthesis it would still be done first because of the hierarchy. The result of 8 is added to 3 making 11. Next a blank line is printed. Finally the final formula is resolved. This means that because of the parenthesis, the addition is resolved first giving 7 and then the 7 is multiplied by 2 giving 14. End will exit the form. This shows the Visual Basic associated with each of the command buttons. The Font Size in txtBox2 is changed through these commands. Background color is changed to Red.
Start of running - directly after Run is clicked. This slide show the run or execution of the form. It starts with green because that was the initial property setting for BackGround.
Run In Run, the Blue button was clicked. This slide shows the blue background in Box1 that happened as a result of executing the code that changed the background to Blue.
Run Result after clicking the Red button. When the Red command button is clicked, the code that changes the BackColor to Red is executed.
Run When the Font14 button is clicked, the font in Box2 changes to a larger font. When the user clicks on Font14, the font size on the text in Box2 is changed. See the Visual Basic instructions that are executed.
Run Pressing the Font10 button returns the font size to 10. Font10 means that the Visual Basic code associated with this button is executed and the font size gets set to 10.
Run The Calculate button causes the code that calculates and prints the results in the picture box to execute. There are four lines. The first line calculates and prints 11 as does the second. The third line prints a blank line and the fourth line calculates and prints 14. You need to be sure to review the hierarchy explained on the next slide. The last button which is the Exit button will exit the program and form and return to design.
Order of operation (working from left to right): Exponentiation Hierarchy Order of operation (working from left to right): Exponentiation Multiplication and/or Division Addition and/or Subtraction To change the order of operation, you can use parenthesis. Please review the order of operation in a programming text.