| | |
Preprocessor directives
![]() |
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?
#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
- no error message but showing project not compiled (C++)
- How do I create my own compiler directives? (C++)
- Preprocessor and typedef (C)
- A few questions about C++ (C++)
- Preprocessor definitions on the command line (C++)
- Pleae help!!! Homework woes! (C++)
- Array or String Comparing Assignment (C++)
- Homework Help, please... [cout, cin] (C++)
Other Threads in the Visual Basic 4 / 5 / 6 Forum
- Previous Thread: New key word not recoginized in VB6 connecting to Access
- Next Thread: Calculate the factorial of a number
| Thread Tools | Search this Thread |
* 6 429 2007 access activex add age application basic beginner birth bmp calculator cd cells.find click client code college component connection connectionproblemusingvb6usingoledb copy creat ctrl+f data database datareport date delete dissertations dissertationthesis dissertationtopic edit error excel excelmacro file filename form hardware header iamthwee image inboxinvb internetfiledownload keypress label listbox listview liveperson login looping machine microsoft movingranges number objectinsert open oracle password prime program prompt range-objects readfile reading record refresh remotesqlserverdatabase report save search sendbyte sites sort sql sql2008 sqlserver subroutine tags textbox time urldownloadtofile vb vb6 vb6.0 vba visual visualbasic visualbasic6 web window windows





