Thursday, May 21, 2009
Week 13
On our Tuesday class this week we had a Chapter 6 test. It contained Multiple Choice questions, True or False questions and complete the sentence questions, and was all open book. I scored 100%.
Thursday, May 7, 2009
Week 11
This week I completed work on the alarm clock assignment. This week I learnt was how to open a document from the program by using this piece of code:
System.Diagnostics.Process.Start(Application.StartupPath & "\HELP.pdf")
Also I initially had trouble getting the program to add five minutes to the set alarm time when the snooze button was pressed. I acomplished this by declaring my stored alarm time as a date and then using AddMinutes to add five minutes:
Dim dtOrigTime As Date = strAlarmTime
strAlarmTime = dtOrigTime.AddMinutes(+5).ToString("HH:mm:ss")
System.Diagnostics.Process.Start(Application.StartupPath & "\HELP.pdf")
Also I initially had trouble getting the program to add five minutes to the set alarm time when the snooze button was pressed. I acomplished this by declaring my stored alarm time as a date and then using AddMinutes to add five minutes:
Dim dtOrigTime As Date = strAlarmTime
strAlarmTime = dtOrigTime.AddMinutes(+5).ToString("HH:mm:ss")
Thursday, April 30, 2009
Week 10
This week I completed work on the CatsAndDogs2 assignment as well as the classes assignment.
Monday, April 27, 2009
Now Methods
Methods of Now:
- Add: adds the value of the specified TimeSpan to the DateTime value.
- AddDays: adds the specified number of days to the DateTime value.
- AddHours: adds the specified number of hours to the DateTime value.
- AddMilliseconds: adds the specified number of milliseconds to the DateTime value.
- AddMinutes: adds the specified number of minutes to the DateTime value.
- AddMonths: adds the specified number of months to the DateTime value.
- AddSeconds: adds the specified number of seconds to the DateTime value.
- AddYears: adds the specified number of years to the DateTime value.
- DaysInMonth: returns the number of days in the specified month of the specified year.
- IsLeapYear: returns an indication of whether the specified year is a leap year.
- Subtract: subtracts the specified time or duration from the DateTime value.
- ToLocalTime: converts the current Coordinated Universal Time (UTC) to local time.
- ToLongDateString: converts the value of this instance to its equivalent long date string representation.
- ToLongTimeString: converts the value of this instance to its equivalent long time string representation.
- ToShortDateString: converts the value of this instance to its equivalent short date string representation.
- ToShortTimeString: converts the value of this instance to its equivalent short time string representation.
- ToUniversalTime: converts the current local time to Coordinated Universal Time (UTC).
Sunday, April 26, 2009
Using VB Resources
A more effective way of displaying images in your Cats and Dogs 2 program, (or any other program), would be to utilise the resources feature of Visual Studio. To do this right click on CatsAndDogs2 project in Solution Explorer and select properties. Click resources on the left and then the little arrow next to Add Resource, and choose Add Existing File. Navigate to your files and open them all. Now they are stored in your resources.
To use them in your Cats and Dogs 2 program you need to open your dog class; and in the Private Sub CreateArray() method; instead of using:
_imgPictures(0) = Image.FromFile("G:\Visual Studio\CatsAndDogs2\CatsAndDogs2\slides\1.gif")
_imgPictures(0) = Image.FromFile("G:\Visual Studio\CatsAndDogs2\CatsAndDogs2\slides\1.gif")
You can get your image from the resources by coding:
_imgPictures(0) = My.Resources._1()
_imgPictures(0) = My.Resources._1()
Repeat this for all images in your array and then do the same thing for the cat class.
Doing this will allow your program to find your images no matter if you move the program to another location.
Friday, April 24, 2009
Week 9
Back from holidays we were given two assignments.
The first is finishing the Cats and Dogs 2 program which we were given instructions for. It's due Monday May 4th.
The next assignment is about classes and is due May 26th.
During class we worked on the Cats and Dogs 2 program Assignment.
On our Tuesday class we had a Chapter 5 test. It contained Multiple Choice questions, True or False questions and complete the sentence questions, and was all open book. I scored 100%.
The first is finishing the Cats and Dogs 2 program which we were given instructions for. It's due Monday May 4th.
The next assignment is about classes and is due May 26th.
During class we worked on the Cats and Dogs 2 program Assignment.
On our Tuesday class we had a Chapter 5 test. It contained Multiple Choice questions, True or False questions and complete the sentence questions, and was all open book. I scored 100%.
Thursday, April 2, 2009
Week 8
This week we looked at class diagrams and the OpenFileDialog.
Then we began making a program called Cats and Dogs 2 that uses panels so that we can change their visible properties to show different information. We had to use labels, textboxes, buttons picture boxes and combo boxes. We had to also use the OpenFileDialog to allow a picture file in JPEG or GIF format to be selected from anywhere on the computer and have it displayed in a picture box. We also used the With statement.
The next class Rachael was away and asked us to complete the chapter 5 crossword and practice test on the Visual Basic book's compliment website.
Sunday, March 29, 2009
VB.Net OpenFileDialog
OpenFileDialog in VB.Net allows the user to browse for a file and open it.
Properties of the OpenFileDialog are as follows:
Properties of the OpenFileDialog are as follows:
- AddExtension: Gets/Sets if the dialog box adds extension to file names if the user doesn't supply the extension.
- CheckFileEixsts: Checks whether the specified file exists before returning from the dialog.
- CheckPathExists: Checks whether the specified path exists before returning from the dialog.
- DefaultExt: Allows you to set the default file extension.
- FileName: Gets/Sets file name selected in the file dialog box.
- FileNames: Gets the file names of all selected files.
- Filter: Gets/Sets the current file name filter string, which sets the choices that appear in the "Files of Type" box.
- FilterIndex: Gets/Sets the index of the filter selected in the file dialog box.
- InitialDirectory: This property allows to set the initial directory which should open when you use the OpenFileDialog.
- MultiSelect: This property when set to True allows to select multiple file extensions.
- ReadOnlyChecked: Gets/Sets whether the read-only checkbox is checked.
- RestoreDirectory: If True, this property restores the original directory before closing.
- ShowHelp: Gets/Sets whether the help button should be displayed.
- ShowReadOnly: Gets/Sets whether the dialog displays a read-only check box.
- Title: This property allows to set a title for the file dialog box.
- ValidateNames: This property is used to specify whether the dialog box accepts only valid file names.
UML Class Diagram
UML stands for Unified Modeling Language. A UML Class Diagram is a static structure diagram that describes the structure of a system by showing the system's classes their interrelationships, and the operations and attributes of the classes.
Class Diagrams must show:
- Classes
- Responsibilities
- Associations
- Inheritance relationships
- Composition associations
- Vocabularies
- Interfaces
Friday, March 27, 2009
Week 7
This week we looked at the Select Case statement. It allows for lots of different operations to occur depending on the value of a single field. In the Select Case program we made we also looked at having something occur depending on which button is pressed in a message box. In this case it was asking if they wanted the text displayed to be reversed.
Next we started making a program called Cats And Dogs.
We had to create 2 classes for this exercise, 1 called Cat the other Dog.
Within each class we had to declare 3 properties, Name, Age and Breed through the Public _ keyword, instead of Dim, and 3 Methods.
Both had a "New" method which is the constructor for the class, the Dog Class also had 1 method called Bark and another called GoWalkies, the Cat Class had 1 method called Meow and another called Chase Mouse.
Next we started making a program called Cats And Dogs.
We had to create 2 classes for this exercise, 1 called Cat the other Dog.
Within each class we had to declare 3 properties, Name, Age and Breed through the Public _ keyword, instead of Dim, and 3 Methods.
Both had a "New" method which is the constructor for the class, the Dog Class also had 1 method called Bark and another called GoWalkies, the Cat Class had 1 method called Meow and another called Chase Mouse.
Monday, March 23, 2009
vb.net Classes & Objects
A class is a type and an object is an instance.
A class is the code itself, the code becomes an object when you start using it.
Objects have properties and methods.
Friday, March 20, 2009
Week 6
This week we looked at creating a program for a mobile device. We did the Guided Program Development task from the end of Chapter 5 called Wood Cabinet Estimate on page 351. This step-by-step allowed us to create a Smart Device Application which calculated the cost estimate depending on the amount of linear feet and the type of wood desired.
We then created the Parking Ticket Fines program found at the end of Chapter 5 in the Programming Assignments on page 370. It is very similar to the Wood Cabinet Estimate program and is also for a mobile device.
Then we had a TEST on Chapter 4 of the book. It contained Multiple Choice questions, True or False questions and complete the sentence questions. It had a possible 86 marks of which I scored 86.
We then created the Parking Ticket Fines program found at the end of Chapter 5 in the Programming Assignments on page 370. It is very similar to the Wood Cabinet Estimate program and is also for a mobile device.
Then we had a TEST on Chapter 4 of the book. It contained Multiple Choice questions, True or False questions and complete the sentence questions. It had a possible 86 marks of which I scored 86.
Friday, March 13, 2009
Week 5
This week we moved on to Chapter 5 and looked at IF statements, ELSE Statements and ELSEIF statements. These allow the program to only run a certain piece of code depending on what the user does. We also used a few new tools, group boxes and radio buttons.
We had to create a program that compared two strings to see if they were equal (=), less than (<) or greater than (>) each other. The result was then displayed in a Message Box. To avoid the program crashing if the user doesn’t enter something into both text boxes we used an if statement at the start of the code, If txtString1.Text <> "" And txtString2.Text <> "" Then, if there wasn’t anything entered we had to display a Message Box with an error message warning the user to enter something into both text boxes.
We had to create a program that compared two strings to see if they were equal (=), less than (<) or greater than (>) each other. The result was then displayed in a Message Box. To avoid the program crashing if the user doesn’t enter something into both text boxes we used an if statement at the start of the code, If txtString1.Text <> "" And txtString2.Text <> "" Then, if there wasn’t anything entered we had to display a Message Box with an error message warning the user to enter something into both text boxes.
Monday, March 9, 2009
ASCII & Unicode
ASCII is the name given to the 256 characters and symbols that make up English and most Western European languages, it is not capable of displaying most other languages such as Asian languages. That is where Unicode comes in. It contains more than 65000 characters and is capable of displaying all the worlds languages, even ancient ones. The first 256 characters of Unicode are the same as ASCII. Visual Basic uses Unicode as its coding system.
Friday, March 6, 2009
Week 4
This week we looked at creating a simple web browser. We used the web browser tool to display the web page; in the code we used wbBrowser.Navigate(strURL) to go to the desired page, (strURL refers to the declared string variable that holds the URL). The form also contained a Back, Home, and Forward button, a text box where the user can type a URL with a GO button that will get the web browser to go to the typed URL, and a Favourites button which will add whatever page is currently loaded into a comboBox.
Then we had to complete the second Programming Assignment of Chapter 4 on page 281, called Taxi Fare. This program is similar to both the Digital Downloads Program and the Concert Tickets Program.
Then we had to complete the second Programming Assignment of Chapter 4 on page 281, called Taxi Fare. This program is similar to both the Digital Downloads Program and the Concert Tickets Program.
Friday, February 27, 2009
Week 3
This week we had to do the Chapter 4 Guided Program Development task from the Visual Basic book called Digital Downloads on page 254. It gives step-by-step instructions on creating the project.
New things looked at this week, Option Strict on (stops automatic conversion of variables), Declaring a constant variable (doesn’t change) and concatenation (&) (joins different values into a single string).
After completing the Digital Downloads program we had to create one called Concert tickets which is found at the end of Chapter 4 in the Programming Assignments on page 279. This program is very similar to the Digital Downloads program but we weren’t guided through step-by-step for this one, we had to create the code ourselves.
New things looked at this week, Option Strict on (stops automatic conversion of variables), Declaring a constant variable (doesn’t change) and concatenation (&) (joins different values into a single string).
After completing the Digital Downloads program we had to create one called Concert tickets which is found at the end of Chapter 4 in the Programming Assignments on page 279. This program is very similar to the Digital Downloads program but we weren’t guided through step-by-step for this one, we had to create the code ourselves.
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.
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.
Sunday, February 15, 2009
Visual Basic Links
Download Visual Basic Express -Download Visual Basic 2008 Express Edition here!!
View information and samples on Visual Basic:
Visual Basic Development Center
Visual Basic Samples
Find valuable resources on Visual Basic:
Visual Basic Resource Center
View information and samples on Visual Basic:
Visual Basic Development Center
Visual Basic Samples
Find valuable resources on Visual Basic:
Visual Basic Resource Center
Friday, February 13, 2009
Week 1
This week we began using Visual Studio. We were shown a few of the basic tools that you can use.
Our first project we used labels, text boxes, buttons and a combo box, and through code we had to enter text from the text box and add it to the list in the combo box, also take text from a text box and display it in a label.
In the second project we also used picture boxes. We had to display the picture that is clicked on in another picture box.
The third project this week we had to allow the user to enter their contact information and then have it all display in labels when they click the submit button, and all the information to clear when they click the clear buton.
Subscribe to:
Posts (Atom)