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")
You can get your image from the resources by coding:
_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%.

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.