By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,558 Members | 1,673 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,558 IT Pros & Developers. It's quick & easy.

Application.Run problem

P: n/a
I posted this accidentally to dotnet.general, but it is a VB.NET problem, so
here it is again ...

With VB.NET in VS 2003 I am using "Sub Main()" as my startup object, and
from within Sub Main() I use "Application.Run(MyMainForm)". Essentially I am
starting my application and then displaying the form, rather than setting
the form as the startup object. This works great except for one major
problem ... I can't access any of the form's controls while in the debugger.
There is no problem accessing local variables in a procedure, but when I try
to access a label control on the form my machine hangs.

What causes this problem and how can I get around it?

It is very consistent - I can always display anything I want at a
breakpoint, except controls on the form. If I try to display them in the
immediate window my machine hangs.

Thanks,

Tom
Nov 21 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
not seeing how you are doing this in code makes a definitive answer in
cide, but three things quickly come to mind...
0) there must be an instance of the form created before you can access
the controls
Dim frm as New MyForm()
1) check the access level of the controls and the methods -- VB sets
things as Protected or Friend
2) this is a bug in Whidbey Beta 1 (I see this with other variables as
well -- something with the debugger -- the variables jump out of scope
before they really should -- a workaround solution is to print values to
the debug window)

Cheers.
---
http://code.box.sk
nemo me impune lacessit

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #2

P: n/a
Further testing shows that the problem occurs due to the use of a timer
object in my program. I have the following in my object's constructor:

moAutoResetEvent = New AutoResetEvent(True)

moIntervalStateTimer = New System.Threading.Timer(moTimerDelegate,
moAutoResetEvent, 0, mnScanIntervalMilliseconds)

If I comment out the lines that create the timer then I have no lockup
problems in the debugger. But with the timer included, as long as I don't
use the debugger the timer fires perfectly and everthing is happy.

Any ideas?

Thanks in advance,
Tom

"Tom Edelbrok" <an*******@anonymous.com> wrote in message
news:WHLge.37690$0X6.17226@edtnps90...
I posted this accidentally to dotnet.general, but it is a VB.NET problem,
so here it is again ...

With VB.NET in VS 2003 I am using "Sub Main()" as my startup object, and
from within Sub Main() I use "Application.Run(MyMainForm)". Essentially I
am
starting my application and then displaying the form, rather than setting
the form as the startup object. This works great except for one major
problem ... I can't access any of the form's controls while in the
debugger.
There is no problem accessing local variables in a procedure, but when I
try
to access a label control on the form my machine hangs.

What causes this problem and how can I get around it?

It is very consistent - I can always display anything I want at a
breakpoint, except controls on the form. If I try to display them in the
immediate window my machine hangs.

Thanks,

Tom

Nov 21 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.