Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

A stupid question?

Status
Not open for further replies.

Np02

Technical User
Mar 14, 2003
21
US
Hi, I just start to study VB by book. Try to get to the immediate window. I started a new project with a form, follow the book instruction : Run the program, pause it, then type the following statement into the immedicate window" Statements:"? Form1.Controls.Count". I click on F5 key on keyboard to run the program, it did run. Then I click on the Pause/Break button on the keyboard, (I do not see any action in the screen), then I open the immediate window (from the debug tab -> window -> immediate), typed in the above statement. I do not get the answer (suppose to be "3"), instead the immedicate window says "The expression cannot be evaluated while in run mode" . It looks that I did not pause the running mode. How do I correct the problem? Didn't I pause the program running by click on the pause/break key in the keyboard? or I have to do something else?

THank you for help my stupippy...

NP0122
 
Use CTRL and the break key at the same time to pause the program.

Robert
 
Thanks, Robert. I use the CTRL key and Break key at the same time. It did stop the program. (I got the Form1 in code view after I press the CTRL and Break keyat the same time.) I then open the immediate window through Debug tab in menu bar and type in " ? Form1.Controls.Count", then Enter key. However, it does not come out "3" (I have 3 controls in form1), instead, I got this note "Reference to a non-shared member requires an object reference". How do I go from here?

Thank you.

NP0122
 
Um...you know...both of those sound like VB.NET error messages, rather than VB5 or 6.

Can you confirm the version of VB you are using, and also confirm what version of VB your book refers to.
 
Yes, you are right. I am using VB.net in my PC. But the book I am using is a VB 6 book. If I like to keep using my VB.Net in my computer and able to use the immediate window to see the control number like the example here, how should I change. Sorry for the insufficient information because I do not know this will make difference.

NP
 
Yes, I rather suspected that that was exactly what yiu had: VB.NET on the PC, and a VB6 book.

I guess I should point out that VB.NET is not not a version upgrade of Vb6. It is a completely new language which bears some superficial resemblence to VB6. However, it works completely differently so you need to get hold of a decent VB.NET book otherwise you are going to keep running into situations where your current book tells you how to do something and VB.NET says "No way"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top