Application.Run problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Tom Edelbrok

    #1

    Application.Run problem

    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.Ru n(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


  • c j anderson, mcp

    #2
    Re: Application.Run problem

    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.
    ---

    nemo me impune lacessit

    *** Sent via Developersdex http://www.developersdex.com ***

    Comment

    • Tom Edelbrok

      #3
      Re: Application.Run problem

      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:

      moAutoResetEven t = New AutoResetEvent( True)

      moIntervalState Timer = New System.Threadin g.Timer(moTimer Delegate,
      moAutoResetEven t, 0, mnScanIntervalM illiseconds)

      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" <anonymous@anon ymous.com> wrote in message
      news:WHLge.3769 0$0X6.17226@edt nps90...[color=blue]
      >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.Ru n(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
      >
      >[/color]


      Comment

      Working...