Results 1 to 9 of 9

Thread: If... Then... blah blah help!

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Location
    North Carolina
    Posts
    12

    If... Then... blah blah help!

    I want to translate this into Visual Basic... Sorry, im new to VB!

    If (this == this_1)
    {
    // Do this
    }
    Else
    If (this == this_2)
    {
    // Do this
    }
    Else
    // Do this

  2. #2
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    Code:
    If this = this_1 Then
        'Do this
    ElseIf this = this_2 Then
        'Do this
    Else
        'Do this
    End If
    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  3. #3
    Junior Member
    Join Date
    May 2002
    Posts
    17
    Code:
    If this1 = this_1 Then
          do stuff
    else
          if this2 = this_2 then
                do more stuff
          else
                do some more stuff
          end if
    end if
    [

  4. #4

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Location
    North Carolina
    Posts
    12
    Thanks!

  5. #5
    Frenzied Member Buzby's Avatar
    Join Date
    Jan 1999
    Location
    UK
    Posts
    1,670
    x0rx0r, that's not what they asked for.. they want to compare THIS with THIS_1 and THIS_2.. so you could write it like;

    Code:
    If this = this_1 Then
          do stuff
    else
          if this = this_2 then
                do more stuff
          else
                do some more stuff
          end if
    end if
    Or you could write it like my answer.
    'Buzby'
    Visual Basic Developer
    "I'm moving to Theory. Everything works there."

  6. #6
    Swatty
    Guest
    Is this C++ code you want to do in vb ?

    Like i see it you try to check two pointers against eachother.

    Don't think you can do it in vb.

    Maybe you can check two objects against eachother.

  7. #7

    Thread Starter
    New Member
    Join Date
    Jun 2002
    Location
    North Carolina
    Posts
    12
    Yes Buzby, the first one worked... maybe i should have wrote the code like this:

    If (this == this_1)
    {
    // Do this
    }
    Else
    If (this == this_2)
    {
    // Do this
    }
    Else
    // If neither of the two... Do this
    // This is kinda like a default...

  8. #8
    Swatty
    Guest
    Ha the this part is not a pointer you try to evaluate.

    Try to use better words next time.

  9. #9
    Super Moderator Wokawidget's Avatar
    Join Date
    Nov 2001
    Location
    Headingly Occupation: Classified
    Posts
    9,632

    Angry Mail.com emails have messed up!!!

    Or you could use:
    VB Code:
    1. Select Case This1
    2.    Case This_1
    3.       'Code here
    4.    Case This_2
    5.       'More code here
    6.    Case Else
    7.       'Even more code here
    8. End Select


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width