Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

code fails win98 but runs win2000 just fine

0 views
Skip to first unread message

Brad Rogers

unread,
Jul 22, 2002, 3:03:50 PM7/22/02
to
All

learning about vb .net the hard way, my program runs fine with win2000 but
when trying to load this on a win98 machine it crashed with unhandled
exception errors.

so I went back and put most everything in try/catch blocks and leaving catch
ex as exception in case I missed anything, at least thats something I
understood to do.

still fails to start, same error.

so I updated that machine, spending most of the day with downloads from
microsoft as to whatever updates related to windows and the ie browser,
taking it from 4.x to 6.0 and doing the security patches it recommends, etc.

still fails to start my program on the win98 machine.

while it runs the win2000 machines ok, on one it causes a CLR (common
language runtime) exception listing about 10 windows.system.object.whatever
items, things not seen in the code anywhere; and the mouse is invisible over
this box. but to make this happen in win2000 it takes a long time.

is there some way to lock in exception handling? or is it simply a mystery
that we add exception traps and hope it does this?

are there common pitfalls like using the timer or accessing a shared
variable?
thanks


Robert Chapman

unread,
Jul 22, 2002, 3:19:24 PM7/22/02
to
There are a few things that you can do to help:
- post the actual exception messages that you are getting
- enable a global error handler by using a module and sub main:

Here is the post of a message from Ken Getz from MS:

If you're using VB.NET (and I assume you are, because you're posting
here), I suggest you don't use On Error at all, but rather, the newer
Try/Catch/Finally blocks. These are far easier to manage, in the long
run.

As for unhandled errors, in a WinForms app, you can react to the
ThreadException event and have an global exception handler for your
application.

In the Sub Main for your application, add code like this (assuming
that your main form is named frmMain):

AddHandler Application.ThreadException, _
AddressOf UnhandledExceptionHandler

' Runs the application.
Application.Run(New frmMain())

Then add a procedure named UnhandledExceptionHandler, doing something
in even of an unhandled error:

Shared Sub UnhandledExceptionHandler( _
ByVal sender As Object, _
ByVal e As ThreadExceptionEventArgs)

MessageBox.Show("Error: " & _
e.Exception.Message, "Unhandled Exception")
End Sub


--
Robert Chapman, MCSD
Manager, Applications Development
prairieFyre Software Inc.
http://www.prairiefyre.com
"Brad Rogers" <roger...@earthlink.net> wrote in message
news:#i7IqHbMCHA.1120@tkmsftngp10...

Brad Rogers

unread,
Jul 22, 2002, 4:00:04 PM7/22/02
to
Dear Robert

thanks very much for this tip. I looked for the sub main() and couldnt find
one, at least like I expected, but in the friend sub main() all thats there
is initialize timer(). then up before in the windows generated code, after
public sub New() I also have initialize timer(). OOPS

I dont know if that would cause any problems or not, but its not correct
syntax.

Ive done this sometimes, on build it complains no sub main(), use one of
these? and has a list.

so Ill make the exception handler like you said, and see what happens.

Ill let you know what happens.

thanks again
"Robert Chapman" <inv...@invalid.com> wrote in message
news:u1XAPRbMCHA.2368@tkmsftngp10...

Robert Chapman

unread,
Jul 23, 2002, 8:13:56 AM7/23/02
to
Add a module to your project, put the sub main there. In your Project
properties change the startup from your form to sub main.

HTH

Cheers

--
Robert Chapman, MCSD
Manager, Applications Development
prairieFyre Software Inc.
http://www.prairiefyre.com
"Brad Rogers" <roger...@earthlink.net> wrote in message

news:uxenFnbMCHA.2228@tkmsftngp08...

0 new messages