Friday, August 6, 2010

Friday, August 6th 2010

Today I am going to take a look at a tutorial by Michael Halvorson, it's a game based on generating random numbers like a slot machine.


PictureBox1.Visible = False


This hides the image (in this case a picture of golden coins I downloaded from the Interweb.

There is also a code for generating the random number which is quite interesting - Rnd generates a random number between 0 and 1 then multiplies it by ten, then uses the Int function to deliver a whole number. The whole thing looks like


txtSlotOne.Text = CStr(Int(Rnd() * 10))


So far Mr. Halvorson's tutorials seem to be a bit more fun than the others. The next tutorial is one that uses the DateTimePicker control. Apparently, I was born on a Tuesday.

The only other thing worth mentioning from that tutorial is the use of & as a string concatention operator.

The next tutorial features to PictureBoxes, one with a calculator in it and one with a printer. I searched for retro 80s images to put use for the fun of it.

Both PictureBoxes have their visibility set to false. By clicking on one (or both) of the two Checkboxes you can toggle the visibility on or off.

An interesting modification would be to allow the user to set the default to both the calculator and the printer to always be on, or to set it so that one is on and one is off, and to have the program remember that the next time it starts. I don't know how to tell the program to save something, though.


If CheckBox1.CheckState = 1 Then
pctCalculator.Visible = True
Else
pctCalculator.Visible = False
End If


The next short tutorial shows us how to use the LinkLabel control.

The LinkLabel control just seems to draw a label, only the text is blue and underlined. Thanks guys, big help.

The code that has to be written seems pretty easy


LinkLabel1.LinkVisited = True
System.Diagnostics.Process.Start _
("http://www.somethingawful.com/")


Unfortunately I goofed and put the code under the FormLoad procedure so it automatically loaded up the web page when I ran the program. Although, that could be useful, too.

Next, I'm gonna work with the MenuStrip control, which is pretty darn cool if you ask me.

Michael Halvorson points out, as does Anne Boehm, the importance of providing access key support, and the ease with which a programmer can do so. All you have to do is type an ampersand (&) before the appropriate letter in the name.

No comments: