Solved

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

Posted on 2006-11-11
4
218 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

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…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

919 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now