Adblock breaks this site

Need some help

Discussion in 'Programming General' started by Cakey Bakey, Nov 20, 2010.

  1. Cakey Bakey

    Cakey Bakey Apprentice
    Banned

    Joined:
    Aug 5, 2009
    Posts:
    668
    Referrals:
    0
    Sythe Gold:
    0
    Need some help

    Hi , I was just wondering if somebody could give me some advice on how to make a simple 'IF' statement , and for it to work properly.
    The statement can be about absolutely ANYTHING.
    I'm an ametaur at programming , and fortunately , my course only has a small amount of programming in it.

    I'd probably learn better if somebody good on Visual Basic on these forums could break it down for me and give me an example or point to point instructions , as aposed to me researching it.

    Thanks.
     
  2. Darthatron

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0
    Need some help

    Assuming you understand Variables, and other basics...

    Code:
    Dim bBoolean As Boolean    'This can be anything
    bBoolean = True            'Sets the value of bBoolean to 'True'
    [B]If[/B] bBoolean = True [B]Then[/B]    'Checks if bBoolean is 'True', and shows the "IT WORKED!" message box if it is.
        MsgBox "IT WORKED!"
    Else                       'Otherwise it shows the "IT FAILED!" message box.
        MsgBox "IT FAILED!"
    End If
    Also, you don't NEED an Else term:
    Code:
    Dim bBoolean As Boolean
    bBoolean = True
    [B]If[/B] bBoolean = True [B]Then[/B]
        MsgBox "IT WORKED!"
    End If
     
  3. Cakey Bakey

    Cakey Bakey Apprentice
    Banned

    Joined:
    Aug 5, 2009
    Posts:
    668
    Referrals:
    0
    Sythe Gold:
    0
    Need some help

    Thanks for your reply Darth :)
    Gonna have a play around and see what I can do. I'll let you know if I have any problems :)
     
  4. Darthatron

    Darthatron Massive Troll
    Retired Sectional Moderator Visual Basic Programmers

    Joined:
    May 22, 2006
    Posts:
    1,612
    Referrals:
    3
    Sythe Gold:
    0
    Need some help

    No problems, I take it?
     
< Apple iPhone 4G 32GB .....................300£uro | PHP,MySQL,HTML,CSS Website Coder offer [paypal] >


 
 
Adblock breaks this site