943,683 Members | Top Members by Rank

Ad:
Apr 29th, 2004
0

Preprocessor directives

Expand Post »
Is there a way in VB to use a '#define' macro something like in c++? In C++ I can do this:

#define CHECKPTR if(!ptr) AfxMessageBox("Pointer is null");

then everywhere I wanted to do that check, (of course the pointer would always have to be named 'ptr'), I could just write this:

ptr = new CSomePointer;
CHECKPTR

the preprocessor actually expands the text in the appropriate places before compiling the code, so I don't have to have that same code everywhere. Is there a way to do this in VB?
Similar Threads
Reputation Points: 19
Solved Threads: 0
Light Poster
BlackDice is offline Offline
43 posts
since Apr 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: New key word not recoginized in VB6 connecting to Access
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Calculate the factorial of a number





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC