October 21, 2014
Hot Topics:
RSS RSS feed Download our iPhone app

Visual Basic Tutorial - Part 5

  • November 5, 2002
  • By Karl Moore
  • Send Email »
  • More Articles »

Functions needn't be simple. Karl explains some practical uses for functions...

Don't forget that a function doesn't have to be as simple as ours. It could contain dozens of lines - perhaps looking in a database of logged-on users and returning a True/False value depending on whether the user is in the table. The function code would go something like this

  • Log onto database
  • Open logon table
  • Check if user is in list
  • If user is in table, set the function value to True - otherwise set it to False

Of course, that's all pseudo-code. Real life coding ain't that simple. Hey, comon - ce la vie!

Then you could use the function like this -

If UserLoggedOn("Jane")=True then
  MsgBox "Jane is logged on!"
Else
  MsgBox "Jane isn't logged on. Sorry!"
End If

Whew! That's a lot to take in. But when you figure out the absolute simplicity of the entire function concept - you'll have sussed Visual Basic. Well done!





Page 4 of 5



Comment and Contribute

 


(Maximum characters: 1200). You have characters left.

 

 


Sitemap | Contact Us

Rocket Fuel