Immediate window?

  • Thread starter Thread starter Mike
  • Start date Start date
Thanks. How do you look at the value of a property of a control on a form?
In VB6, I would have typed:

? formname.controlname.property

but this doesn't seem to work in vb.net
 
No mike that should work (you have to be paused at a breakpoint though)

?Me.Textbox.Text should work fine

Chris
 
You could look at the locals window or set a watch on the control property
and watch it in the watch window.
 
* "Mike said:
Thanks. How do you look at the value of a property of a control on a form?
In VB6, I would have typed:

? formname.controlname.property

but this doesn't seem to work in vb.net

See my other reply.
 
I am getting this:
? me.btncalculators.text

'Me' is valid only within an instance method.



My Locals window is empty and I don't see how to add a Watch (right-click on
Watch window doesn't show Add Watch option).



I am targeting the Compact Framework if that matters (PocketPC). I am in
[break] mode.
 
If Me is out of scope, it won't work. Me is also not available in shared
methods.

Also the command window can be toggled to go to immediate mode. Make sure
you are in immediate mode, not command mode. If I remember, you just type !
to flip to immediate mode.
 
I'm afraid I don't have an answer for you in the general sense.

I think you may have some slight confusion about how forms work in VB.NET (I
could be wrong). I think you are looking at it like there is one active
instance of a form as in VB6 that is always around. Since any form could be
the "Me" member in the current context in VB.NET, what you're trying to do
isn't going to work.

When I'm using the immediate window it's in response to a breakpoint that is
inside the current form, so Me is available. If you're responding to some
event you are trying to debug, I'd just tag that event with a breakpoint and
step it, using the immediate window as a tool. Then Me will be available to
you.

If you need VB6 style global debugging, you can change how your forms works
by adding them to a class as public shared members. Then instead of
creating instances of them. you show and hide that form. They should be
available then in the immediate window at any time, assuming they have been
created with new at some point. But I would only do this if it makes sense
for how you are working with them.

For example, if I have a toolbox type form, I make it shared, because it
really only makes sense to have one toolbox instance per application.

--
Justin Weinberg

Designing a PrintDocument or creating .NET graphics?
Save time with GDI+ Architect.
For more information, visit http://www.mrgsoft.com
 
I was only using "Me" because Chris posted that "Me" should work.

I would probably have used the Forms collection in VB 6 to get a reference
to an open form. There must be some equivalent in vb.net.
 
Back
Top