Re: Printing variables to screen, when in debug




"Richard Jalbert" <richmann@xxxxxxxxxxxx> wrote in message
news:43c072f8.16225421@xxxxxxxxxxxxxxxxxxxxxxxx
> On Sat, 07 Jan 2006 13:04:01 -0800, Bob O`Bob
> <filterbob@xxxxxxxxxxxxxxx> wrote:
>
>>VB_Newby wrote:
>>> I recently picked up VB5 Professional off EBAY. I'm a EE who seems
>>> to think he's a S/W engineer. I'm developing a program to convert
>>> MathCad files to text files - for subsequent importation into a data
>>> evaluation tool (CosmoScope).
>>>
>>> Anyway,
>>> I like to print variables to the screen during debug so I can see
>>> what they are. When I use a PRINT statement the variable appears on
>>> my main frm. However, this is also where my OptionButtons,
>>> textboxes, DirListBox's, etc are located. My print statements get
>>> covered by these controls. I'm forced to the controls -far- down the
>>> form to see the text. MsgBox's also cover the text. Bummer...
>>>
>>> Can anyone recommend a better solution than this.
>>> I'm sure I'm missing something obvious.
>>>
>>> Thanks
>>>
>>> (Also, is this the correct group to post Newby VB questions?)
>>>
>>
>>It sure is.
>>
>>Are you aware of the immediate window, and the Debug object?
>>That's what *I* think of, when I read "print variables to the screen"
>>
>>Try changing your current feedback statements to use Debug.Print and see
>>if
>>you like the difference it makes.
>
> But do remove before compiling as they slow your program down.
> incredible but true, the code tries to be executed but fails.
> Or use conditional compilation.
>
>> Bob

It depends on the statement within Debug.Print. The following is excerpt
from MSDN:


For example, Debug.Print statements, while ignored in the run-time .exe, are
sometimes present in the .exe file.
Debug.Print statements with strings or variables as arguments are not
compiled when you create an .exe. However, where Debug.Print statements have
a function call as an argument, the Debug.Print statement itself is ignored
by the compiler, but the function call is compiled. Then, when the
application is run, the function is called but the return is ignored.
Because functions that appear as arguments to Debug.Print will take up space
and cycle time in an .exe, it may be beneficial to delete these statements
before you make an .exe.

Dmitriy.


.