we had developed an application using vb6.0 and SQL server 2000 a few years ago. recently, some of our customers tell us that while running the application, on some of computers which use Winxp sp2 as their O/S, they get the following error when they want to show the search form:
"Runtime error 380: Invalid property value"
What causes this error?
I presume your application uses a masked edit box? This is a relatively well known problem, documented by Microsoft here:
http://support.microsoft.com/kb/177088
The article refers to VB4 and 5, but I am pretty sure the same is true for VB6.
EDIT
On further research, I am finding references to this problem with other controls as well. Recompiling your application on Windows XP for users that are running XP will probably produce them a working version, though it's not an ideal solution...
Just to throw my two cents in: another common cause of this error in my experience is code in the Form_Resize
event that uses math to resize controls on a form. Control dimensions (Height
and Width
) can't be set to negative values, so code like the following in your Form_Resize
event can cause this error:
Private Sub Form_Resize()
'Resize text box to fit the form, with a margin of 1000 twips on the right.'
'This will error out if the width of the Form drops below 1000 twips.'
txtFirstName.Width = Me.Width - 1000
End Sub
The above code will raise an an "Invalid property value" error if the form is resized to less than 1000 twips wide. If this is the problem, the easiest solution is to add On Error Resume Next
as the first line, so that these kinds of errors are ignored. This is one of those rare situations in VB6 where On Error Resume Next
is your friend.
What causes runtime error 380? Attempting to set a property of an object or control to a value that is not allowed. Look through the code that runs when your search form loads (Form_Load etc.) for any code that sets a property to something that depends on runtime values.
My other advice is to add some error handling and some logging to track down the exact line that is causing the error.
Erl
to report line numbers and find the exact line - MZTools can automatically put in line numbers for you. _
On Error Goto Handler
<routine contents>
Handler:
Err.Raise Err.Number, "(function_name)->" & Err.source, Err.Description
I had the same problem in masked edit box control that was used for Date and the error was due to Date format property in Region settings of windows. Changed "M/d/yyyy" to "dd/MM/yyyy" and everything worked out.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With