Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > Define


Reply
 
Thread Tools Display Modes
  #1  
Old 12-30-2002, 03:40 AM
Eran Eran is offline
Regular
 
Join Date: Dec 2002
Location: Israel
Posts: 81
Default Define


Hi,guys.
Just wouder if VB has a Key word "define" like in c,c++.
I know that Vb is a interpetor and c,c++ are compiled prog.
still...
Reply With Quote
  #2  
Old 12-30-2002, 03:48 AM
Flyguy's Avatar
Flyguy Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 18,928
Default

VB is compiled too.

You can use #If, #Else and #End if
You can specify them in the "conditional compilation arguments" in the project properties, it's not exactly the same as in C, but maybe you can use them.
Reply With Quote
  #3  
Old 12-30-2002, 05:15 AM
Eran Eran is offline
Regular
 
Join Date: Dec 2002
Location: Israel
Posts: 81
Default

I C...
But can I use the "DEFINE" Staement?
Reply With Quote
  #4  
Old 12-30-2002, 06:09 AM
Flyguy's Avatar
Flyguy Flyguy is offline
Lost Soul

Super Moderator
* Guru *
 
Join Date: May 2001
Location: Vorlon
Posts: 18,928
Default

No
Reply With Quote
  #5  
Old 12-30-2002, 06:56 AM
Machaira's Avatar
Machaira Machaira is offline
Jedi Coder

* Expert *
 
Join Date: Aug 2002
Location: Abingdon, MD
Posts: 3,438
Default

You can define constants by using the Const statement, which is part of what #define does.
Reply With Quote
  #6  
Old 12-30-2002, 12:24 PM
shmoove shmoove is offline
Senior Contributor

Retired Leader
* Expert *
 
Join Date: Sep 2002
Location: Israel
Posts: 918
Default

Like this:
Code:
Option Explicit #Const bDebug = True Private Sub Something() #If bDebug Then ' all this code won't get compiled if you set bDebug = False Debug.Print "Debugging" #End If End Sub
You can also set the conditional compilation arguments (bDebug in our case) in the Make tab of Project Properties... instead of using #Const.
__________________
Have you tried looking right in front of you (or at least in MSDN)?
Reply With Quote
  #7  
Old 12-31-2002, 05:39 AM
Eran Eran is offline
Regular
 
Join Date: Dec 2002
Location: Israel
Posts: 81
Default

mmm....

Does VB support a method like "DEFINE" in c,c++?
Reply With Quote
  #8  
Old 12-31-2002, 06:25 AM
Machaira's Avatar
Machaira Machaira is offline
Jedi Coder

* Expert *
 
Join Date: Aug 2002
Location: Abingdon, MD
Posts: 3,438
Default

Not exactly like it, no. But there are workarounds as was noted above.
Reply With Quote
  #9  
Old 12-31-2002, 12:43 PM
Eran Eran is offline
Regular
 
Join Date: Dec 2002
Location: Israel
Posts: 81
Default

I c...
any way, thanks for your help.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->