Solved

what does the # mean in front of a line is it a comment??

Posted on 2006-11-11
4
234 Views
Last Modified: 2010-04-23
i have a program im useing and it has # in front of the lines

the lines are pulled all the way to the left and not in structured as the others are

is this a sort of comment line and does not do anything inside to the next # line ie

# if this = that then
print to screen and move on
# end if

the lines are simmaler to the above (and i have found it does not do the instructions in the middle of the # lines too

is this the case it does not run the block??

thanks for enlightenment here
0
Comment
Question by:Johnny
  • 2
4 Comments
 
LVL 29

Expert Comment

by:Nightman
ID: 17921069
the #If...Then...#Else directives evaluate what is compiled by the compiler and not at run time.

Conditional compilation is typically used to compile the same program for different platforms. It is also used to prevent debugging code from appearing in an executable file. Code excluded during conditional compilation is completely omitted from the final executable file, so it has no effect on size or performance.
0
 
LVL 29

Assisted Solution

by:Nightman
Nightman earned 250 total points
ID: 17921089
You can set conditional compilation constants in one of three ways:

1. In the Property Pages dialog box of the project (see constants under the BUILD menu)
2. At the command line when using the command-line compiler
3. In your code

Have a look at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcn7/html/vacondeclaringconditionalcompilationconstants.asp
0
 
LVL 10

Accepted Solution

by:
Kinger247 earned 250 total points
ID: 17921097
They are compiler conditional statements.

If the if statement is true, then the code between the condition is inlcuded the build.

So, for example the below code would only include the messagebox "I'm in debug" if the current ide is set to debug.
Otherwise its set to "I'm in release"

#If DEBUG Then
  MessageBox.Show("I'm in debug")
#Else
  MessageBox.Show("I'm in release")
#End If

You can also do this on procedures etc to.
The below code would opnly allow the RunME procedure to run if the InTestMode is true. Otherwise, all calls to the procedure will not function.

Public Class Form1
  #Const InTestMode = True

  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    RunME()
  End Sub

  <Conditional("InTestMode")> Public Sub RunME()
    MessageBox.Show("InTestMode")
  End Sub
End Class
0
 

Author Comment

by:Johnny
ID: 17921113
oh hey thats neet ... thanks i thought i maybe a comment as php and others do...

thanks allot
now let me think on how to award the points....
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Microsoft Reports are based on a report definition, which is an XML file that describes data and layout for the report, with a different extension. You can create a client-side report definition language (*.rdlc) file with Visual Studio, and build g…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question