|
-
Apr 30th, 2009, 05:15 PM
#1
Thread Starter
Hyperactive Member
#If DEBUG Then - What is it?
Code:
#If DEBUG Then
LogMessage("Did first thing")
#End If
What is it? how to use that? what are the advatages of using it ?
-
Apr 30th, 2009, 05:37 PM
#2
Re: #If DEBUG Then - What is it?
it's called a compiler directive... it's a way of telling the compiler, "Hey, only run this stuff if the DEBUG flag has been set." ... that way it only runs while in debug mode, but doesn't run in the compiled code.
-tg
-
Apr 30th, 2009, 05:42 PM
#3
Re: #If DEBUG Then - What is it?
Debug is used as a development tool to view the values of you variables
eg:
Dim sName as string
sName = "Sally"
Debug.Print sName Looking in the immediate window will show Sally
or Debug.Print App.Path will show the path you are working on
many, many uses
Very handy tool
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders 
-
Apr 30th, 2009, 05:43 PM
#4
Re: #If DEBUG Then - What is it?
 Originally Posted by techgnome
it's called a compiler directive... it's a way of telling the compiler, "Hey, only run this stuff if the DEBUG flag has been set." ... that way it only runs while in debug mode, but doesn't run in the compiled code.
-tg
I didn't know that
Waiting for a full featured smart phone with out marrying a provider
Go Android
Go raiders 
-
Apr 30th, 2009, 06:22 PM
#5
Hyperactive Member
Re: #If DEBUG Then - What is it?
hey csKanna
#if is the compiler directive means it directs compiler to do some conditional tasks
following is the simple example just create an standard empty project and place a command button and then paste following in code window
you will only get one messagebox because you have not DEBUGGING set
vb Code:
Private Sub Command1_Click() #If DEBUGGING Then MsgBox "hello this is show when DEBUGGING is set" #End If MsgBox "This will be shown always" End Sub
after checking once just go to properties of project and under make tab u will find last text box named conditional compilation arguments and paste there the following statement
and then run the project again and click on button then will see the actual difference
NOTE : Debug is predefined object as @isnoend07 said so it can't be used for conditional compilation
hope this description will help you :-)
* If my post helped you, please Rate it
* If your problem is solved please also mark the thread resolved it is there in right top of page under thread tools
* Why Rating is useful
-
Apr 30th, 2009, 06:44 PM
#6
Addicted Member
Re: #If DEBUG Then - What is it?
I'm also curious. I know there are two predefined precompilation constants, i. e. Win16 and Win32. You can write code like
#If Win32 then
...
#End If
if you want that your code would compile only under Win32. I think these are the only predefined precompilation constants in VB6. However, according to MSDN http://msdn.microsoft.com/en-us/library/swfss70d.aspx, there should also be other predefined constants. Do you think VB6 implements them? I tried, but those constants don't get capitalized as you type them, unlike Win16 and Win32, so I would guess they're not implemented. What do you think?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|