Thursday, November 6, 2008

More and More Visual Basic

You know how I said I don't understand everything in VB? Well, yeah, now I do. I don't even need my notes or another program for an example to write my own programs. I just completely understand everything, and the assignments I've been receiving for the past 2 days have been completed in like 10 minutes tops. It doesn't even come down to thinking, and it's about how quick I am with a keyboard and mouse.

The last 2 day's assignments we're based on input boxes, message boxes, other pop up boxes, and if statements.

A message box, well, pops up a message for you to read. It's a simple task to do, and gives you a lot of extra options in writing programs, and assignments.

The code for a message box is~
msgbox "blah blah blah"

An input box allows you to input information, and helps you have variety in programs. Instead of using a textbox, for example, you could use an input box to get information/data from the user. It's gonna be really useful in the future.

The code for an input box is~
inputbox "What is your blah blah blah?"

An if statement is code that switches messages and other things, according to what you do. For example, writing a number under 5 in an input box would pop up a message box saying "that's low" or something, but if you write a number over 5, it would say "that's average. An if statement is very useful, and much more advanced computer programming from what we're accustomed to. It must be foolproof to make sure people can't fool the system, so it requires you to use different codes according to the type of program you're working on.

To start an if statement section, you use the code~

if variable >= # then

The "if" starts it, and the variable is what it determines. It doesn't necessarily need to be a variable, but that's the one we've been using for the past few days. The ">=" means greater than and equals, which is similar to math. You can also use <, which is less than. The "then" refers to what happens once the variable or whatever is before, after, or equaling the statement. A common example, which we used in our prior questions, is using a message box.

Other codes, that deal with if statements include~

elseif, else, and endif
"Elseif" works just like if, but it adds onto what you've said in the beginning of the "if" code; "Else" is whatever else you haven't specified; and endif ends the if statement.

That's what we've been learning for the past few days in TIK201. I'm so glad that I get everything I'm doing, and I'm having lots of fun too!

Posted by Chris Kaminski at 2:06 PM