Friday, February 20, 2009

Week 2

The Visual Basic book arrives!!! – Site that compliments book: scsite.com/vb2008
This week we looked at more tools we can use in visual studio including list boxes and check boxes, and the different events we can use for them such as load, close, click, double click, checked, index changed.
We also looked at Declaring a variable, the different types of variables, such as strings, integers, decimal, Boolean and date, and the scope of a variable (where it can be referenced in the code). We had to create a program that counted every time a user clicked the mouse and display this in a label. We did this by declaring an integer variable called intMouseClicks in the Declarations area of the code and then in the click event of the form we had to add 1 to this variable with this code: intMouseClicks = intMouseClicks + 1. We then converted this integer to a string and told the text property of the label that it equals the variable: lblMouseClicks.Text = intMouseClicks.ToString.
Next we had to create another program that worked as a simple calculator. The user was given two text boxes where they could enter a number in each and then press a button which would calculate the result and display it in a label. We did this for addition, multiplication, subtraction and division.

No comments:

Post a Comment