CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2009
    Location
    Brazil
    Posts
    25

    [REQUEST] What does #IF Means

    Hello there.
    I saw some codes that have the sharp characters in front of an IF, like:

    x = true
    #If x then
    msgbox "omg, its true"
    #End If

    But i saw too that the msgbox never was displayed.

    Someone can tell me what this sharp means?

  2. #2
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: [REQUEST] What does #IF Means

    It is a compiler directive

  3. #3
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: [REQUEST] What does #IF Means

    from an old class module that I have not looked at in years.

    Code:
      #If kilr Then
        frmKILR.datKILR(Me.Index).Recordset.Delete
      #Else
        DesktopVBA.datVBA.Recordset.Delete
      #End If
    The class is used in 2 different programs one called kilr the other called desktopvba. If I am compiling the KILR program then the line in the first condition goes into the exe otherwise it uses the other line instead.

  4. #4
    Join Date
    Jul 2008
    Location
    WV
    Posts
    5,362

    Re: [REQUEST] What does #IF Means

    To get your code to show the message box you would need to go into your project properties then go to the Make tab and set the conditional compilation arguements to X=1 or X=True

    In the case above there is a line written to the KILR project file that look slike this.

    CondComp="kilr = 1"
    This is actually set using the properties dialog but gets written to the vbp file
    Last edited by DataMiser; July 20th, 2009 at 04:59 PM.

  5. #5
    Join Date
    Jul 2009
    Location
    Brazil
    Posts
    25

    Re: [REQUEST] What does #IF Means

    Now i understood it. Thanks!

  6. #6
    Join Date
    Jul 2009
    Location
    Brazil
    Posts
    25

    Re: [REQUEST] What does #IF Means

    But still one question:
    How do i declare two or more arguments?
    I tried ",.|;" but no one worked.

    EDIT:
    Forget it. It's ":".
    For those who wanna know more about: http://www.buygold.net/v03n11/v03n11.html
    Last edited by Ash Katchup; July 20th, 2009 at 05:10 PM.

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

Featured