470,591 Members | 1,484 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,591 developers. It's quick & easy.

Unexpected Error!!

A VB6 program that I created has been installed on a wide range of computers
and networks without any problems. Win 95, Win 98 and XP so far..
Occasionally, however, the function refuses to start on some systems, with
the only response being a critical error: 'Unexpected Error!', without even
trying to run.

Well! I didn't expect it, either!

Re-compiling and re-installing doesn't change anything. The program is
nothing really special. Reading, modifying and rewriting files is all it
does and all the files it needs to read are pre-written during install..

Does anyone have any idea what sort of problems commonly produce such a
message? Is the range of suspects far too great to even guess? Why does
it start OK on most computers but refuses on one or two?

Frustrating!!! A meaningful error message would help.

Don
Mar 5 '06 #1
8 12378
D & J G wrote:
A VB6 program that I created has been installed on a wide range of computers
and networks without any problems. Win 95, Win 98 and XP so far..
Occasionally, however, the function refuses to start on some systems, with
the only response being a critical error: 'Unexpected Error!', without even
trying to run.

Well! I didn't expect it, either!


I suggest you put some logging in your code to see how far it gets if
anywhere.
Does it ever run on a machine its failed on?
Are you using any custom controls?

--
Dean Earley (de*********@icode.co.uk)
i-Catcher Development Team

iCode Systems
Mar 7 '06 #2
** Responses interspersed..

"Dean Earley" <de*********@icode.co.uk> wrote in message
news:44***********************@news.zen.co.uk...
D & J G wrote:
A VB6 program that I created has been installed on a wide range of
computers and networks without any problems. Win 95, Win 98 and XP so
far.. Occasionally, however, the function refuses to start on some
systems, with the only response being a critical error: 'Unexpected
Error!', without even trying to run.

Well! I didn't expect it, either!
I suggest you put some logging in your code to see how far it gets if
anywhere.


** Not sure how to do this. I'm somewhat a newbie :O(
Does it ever run on a machine its failed on?
** No. Refuses to start.
Are you using any custom controls?
** No

** Thanks for your input.

--
Dean Earley (de*********@icode.co.uk)
i-Catcher Development Team

iCode Systems

Mar 8 '06 #3
D & J G wrote:
** Responses interspersed..

"Dean Earley" <de*********@icode.co.uk> wrote in message
news:44***********************@news.zen.co.uk...
D & J G wrote:
A VB6 program that I created has been installed on a wide range of
computers and networks without any problems. Win 95, Win 98 and XP so
far.. Occasionally, however, the function refuses to start on some
systems, with the only response being a critical error: 'Unexpected
Error!', without even trying to run.

Well! I didn't expect it, either!

I suggest you put some logging in your code to see how far it gets if
anywhere.


** Not sure how to do this. I'm somewhat a newbie :O(


Either open a file for append and "print" to it, or msgboxes in key
places in the code.

--
Dean Earley (de*********@icode.co.uk)
i-Catcher Development Team

iCode Systems
Mar 9 '06 #4

"D & J G" <do********@optusnet.com.au> wrote in message
news:44**********************@news.optusnet.com.au ...
A VB6 program that I created has been installed on a wide range of computers
and networks without any problems. Win 95, Win 98 and XP so far..
Occasionally, however, the function refuses to start on some systems, with the
only response being a critical error: 'Unexpected Error!', without even trying
to run.

Well! I didn't expect it, either!

Re-compiling and re-installing doesn't change anything. The program is
nothing really special. Reading, modifying and rewriting files is all it does
and all the files it needs to read are pre-written during install..

Does anyone have any idea what sort of problems commonly produce such a
message? Is the range of suspects far too great to even guess? Why does it
start OK on most computers but refuses on one or two?


No two computers are exactly alike. Stuff happens. If it's weird, don't ask the
why question :)

Some things you might check:

Which OS does it sometimes fail on? (I'm guessing XP...)
Where did you put those files "pre-written during install"? (I'm guessing
Program Files...)
Did you run a setup for the program? Look at the list of files in the setup
(setup.lst). Is every one of those files on the pesky machine? Is each one at
least as new as the version in your setup? Are your "pre-written" files present?

One possible scenario is that while many XP users are set up as machine
administrators, you have encountered someone who is not. They may be denied
permission to install some dlls, or may not have read/write permissions on files
located in Program Files. If your program tries something very early in startup
that is denied, the program might not be perceived by the OS to have even loaded
up and started, hence the "unexpected" error. The most common cause is probably
file permissions.
Mar 10 '06 #5

"D & J G" <do********@optusnet.com.au> wrote in message
news:44**********************@news.optusnet.com.au ...
** Responses interspersed..
...
I suggest you put some logging in your code to see how far it gets if
anywhere.


** Not sure how to do this. I'm somewhat a newbie :O(


You can create a sub such as..

Sub myDebug(mystr$)
dim f$
f$ = App.Path & "\debug.txt"
Open f$ for append as # 1
print #1, mystr$
Close
End Sub
And call this routine to write out "markers where you're at in the program.
For example

Call myDebug("In sub MAIN getting preferences")
Call myDebug("Getting user network ID..")

Reading user settings..
etc.. etc..

Examining the file will give you an idea how far you get and where the
program may have issues..
Mar 10 '06 #6

"Raoul Watson" <Wa*****@IntelligenCIA.com> wrote in message
news:tLbQf.19671$6h1.18785@trndny09...

"D & J G" <do********@optusnet.com.au> wrote in message
news:44**********************@news.optusnet.com.au ...
** Responses interspersed..
> ...
> I suggest you put some logging in your code to see how far it gets if
> anywhere.


** Not sure how to do this. I'm somewhat a newbie :O(


You can create a sub such as..

Sub myDebug(mystr$)
dim f$
f$ = App.Path & "\debug.txt"
Open f$ for append as # 1
print #1, mystr$
Close
End Sub
And call this routine to write out "markers where you're at in the
program.
For example

Call myDebug("In sub MAIN getting preferences")
Call myDebug("Getting user network ID..")

Reading user settings..
etc.. etc..

Examining the file will give you an idea how far you get and where the
program may have issues..

When running, as soon as the code gets to
myDebug
I get the message

Compile Error:
"Argument not optional"

Huh! Am I too green for this?
Don
Mar 11 '06 #7

"D & J G" <do********@optusnet.com.au> wrote in message
news:44***********************@news.optusnet.com.a u...
When running, as soon as the code gets to
myDebug
I get the message

Compile Error:
"Argument not optional"


the routine expect a string to be passed. If you omit it, you will get an
error.
If you use a variable, make sure the variable is declared as a string, e.g

Dim mystr as String
....
mystr = "Getting user network ID."
call myDebug(mystr)

if not, you'll get a byref argument type mismatch. test out the routine by
itself
Just create a form with a button:

Private Sub Command1_Click()
Dim mystr As String
mystr = "Cmd 1 Pressed"
Call myDebug(mystr)
End Sub

Sub myDebug(mystr$)
Dim f$
f$ = App.Path & "\debug.txt"
Open f$ For Append As #1
Print #1, mystr$
Close
End Sub
Mar 11 '06 #8

"Raoul Watson" <Wa*****@IntelligenCIA.com> wrote in message
news:%IzQf.3$Vb.2@trndny01...

"D & J G" <do********@optusnet.com.au> wrote in message
news:44***********************@news.optusnet.com.a u...

When running, as soon as the code gets to
myDebug
I get the message

Compile Error:
"Argument not optional"


the routine expect a string to be passed. If you omit it, you will get an
error.
If you use a variable, make sure the variable is declared as a string, e.g

Dim mystr as String
...
mystr = "Getting user network ID."
call myDebug(mystr)

if not, you'll get a byref argument type mismatch. test out the routine by
itself
Just create a form with a button:

Private Sub Command1_Click()
Dim mystr As String
mystr = "Cmd 1 Pressed"
Call myDebug(mystr)
End Sub

Sub myDebug(mystr$)
Dim f$
f$ = App.Path & "\debug.txt"
Open f$ For Append As #1
Print #1, mystr$
Close
End Sub

Thank you so much, Raoul. How dumb I feel! All was OK except that I hadn't
declared the variable (Duh).

All is well now. Just have to test it in my program.

Don
Mar 11 '06 #9

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

By using this site, you agree to our Privacy Policy and Terms of Use.