Results 1 to 9 of 9

Thread: [RESOLVED] Immediates window? Whats it for?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Resolved [RESOLVED] Immediates window? Whats it for?

    What is the Immediates window used for? It always pops up when i run the program. Whats it do?
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: Immediates window? Whats it for?

    While you are debugging your program (eg: you have reached a breakpoint or pressed the "pause" icon) you can run code, such as:
    Code:
    Print x + 3
    ..or:
    Code:
    form1.show

  3. #3
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    Re: Immediates window? Whats it for?

    you can use it to inspect the value of things... execute simple code... and even use it to change the value of variables...

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  4. #4

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: Immediates window? Whats it for?

    So i can type things into it? And have it do things not in the code for the project?
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  5. #5
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Immediates window? Whats it for?

    Quote Originally Posted by Gamemaster1494 View Post
    So i can type things into it? And have it do things not in the code for the project?
    More or less, yes. It does allow you to change public variable values and values local to the routine that the code stopped in. You can call public functions and private functions within the module that the code stopped in.

    You can also use it within your code to see values. Example.
    Code:
    Dim X As Long, lSum As Long
    For X = 1 to 10
        lSum = lSum + Int(Rnd * 1000)
        Debug.Print lSum
    Next
    ' open immediate window (Ctrl+G) and see the results
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Immediates window? Whats it for?

    In its simplest form it is a debugging tool (and an invaluable debugging tool) that you should become intimate with.

    http://msdn.microsoft.com/en-us/libr...ffice.10).aspx

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: Immediates window? Whats it for?

    oh. ok. thank you all so much for the fast replys!
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

  8. #8
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: [RESOLVED] Immediates window? Whats it for?

    To save a few keystrokes you don't need to type

    Print MyVar

    to see the value of MyVar. You can just do

    ?MyVar

    Besides printing and changing your variables you can also temporarily change the location and/or size of controls and/or your form. This can be useful if say you are designing a form and you want to move some control a little bit but you don't know exactly how much. In the Immediate Window you can type MyControl.Left = 1234 or MyControl.Left = 1245, etc until you have it exactly right, and once you have the value you can change MyControl's Left property in the IDE. That's a lot faster than doing it over and over in the IDE directly.

    BTW some uses of the Immediate Window are discussed in my VB6 Debug Tutorial.

  9. #9

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2009
    Location
    Missouri
    Posts
    770

    Re: [RESOLVED] Immediates window? Whats it for?

    oh. Okay. I get it now. thanks!
    Rate my post if i helped you!


    Button Configuration Control For VB6 GetAsyncKeyState
    I'm the 7th best high school programmer in the nation!(according to SkillsUSA Nationals)(Used C#.Net)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width