[vb6] What causes this error? "Runtime error 380: Invalid property value"

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?

This question is related to vb6 runtime-error

The answer is


I think, basically the problem lies in the fact, as to under what version of the O/S has the programme been compiled and under what version of the O/S are you running the programme. I have seen a lot of updated dll and ocx files causing similar errors, especially when the programme has been compiled under older version of the dll and ocx files and during set up the latest dll and ocx files are retained.


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


One reason for this error is very silly mistake in code. If proper value is not passed to a property of ActiveX, then also this error is thrown.

Like empty value is passed to Font.Name property or text value is passed to Height property.


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.


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.


Old thread, but here is an answer.

Problematic fonts with voyager

ie. if you install some corel suite, drop some language options away. We dig through this with process monitor and found the reason, with us it was these two font files.

DFKai71.ttf dfmw5.ttf

We had same problem and it was fixed by removing these two font files from windows\fonts folder.


2017 I know... but someone is facing this problem during their code maintenance.

This error happened when I tried:

maskedbox.Mask = "#.###"
maskedbox.Text = "12345678"

To fix that, just set PromptInclude property to "false".


If you write software, or use software written, which stores program window coordinates or sizes to be resused when starting a program, check there for any occurrence(s) of such sizes and positions which would be causing this. I've seen it time and time again from various vendors lazily producing code which resizes and repositions controls on a "form" (a program window) based on the size of said form. Look in HKLM\Software\Vendor\Program and HKCU\Software\Vendor\Program. Look for specific keys which might be offending. I once had a program store -48000 for the program window position in keys called WindowsPosX and WindowPosY. You could see the program start and running on the taskbar but since the program window itself was smaller than 48000 (the absolute value of -48000), it was positioned completely off the screen. If you're not comfortable with editing regstry information - most people aren't - then uninstall the software, use a registry cleaner to remove any leftover entries then reinstall the software and see if that doesn't fix the problem.


Looks like the answers above are for when you are writing and compiling a program, but I'm using a Vendor's software, Catalog.exe, part of the Voyager card catalog by "Ex Libris" and I'm getting the error as well:

catalog-error.png http://img805.imageshack.us/img805/8275/catalogerror.png

I have two Windows 7 32-bit machines. The newer one is giving me the error but on the older one it runs fine. I have done a lot of research with Google and here are some of the things I've found that people are saying related to this issue. Maybe one of these things will help fix the error for you, although they didn't work for me:

From what others are saying (like David M) I think it could be related to the MSVBM60.DLL library - but it appears that on both of my computers this file is the exact same (same version, size, date, etc).

Since that file wasn't different I tried to find what other (dll) files the application could be using, so I launched Process Explorer by Sysinternals and took a look at the application (it loads and then crashes when you tell it to "connect"), and the screenshots below are what I found.

screen1.png http://img195.imageshack.us/img195/2231/screen1oo.png

screen2.png http://img88.imageshack.us/img88/2153/screen2ao.png

screen3.png

Now, I'm not a Windows / VB programmer, just a power user, and so I'm about at the end of my knowledge for what to do. I've talked to the software vendor and they recommend reinstalling Windows. That will probably work, but it just bugs me that this program can run on Windows 7, but something on this particular system is causing errors. Finally, this is an image that has been deployed on multiple machines already and so while re-installing Windows once is not a big deal it would save me some serious time if I could figure out a fix or workaround.


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.

  • Logging Sprinkle statements through the code that say "Got to X", "Got to Y", etc. Use these to find the exact location of the error. You can write to a text file or the event log or use OutputDebugString.
  • Error handling Here's how to get a stack trace for the error. Add an error handler to every routine that might be involved, like this code below. The essential free tool MZTools can do this automatically. You could also use 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 

Could be you are locating in the screen a control (label, frame, text..) out of the screen borders. If the position of some control depends of any variable, and that variable is not correctly defined at start, you may have this error message.

May be you have different screen resolution in both computers. And that could be the reason.

in order to find the program bug, put this line in all subs: on error resume next

if this correct the problem, you must clear this line in every sub, one by one, and verifying if the problem returns. When the problem returns after removing this line in a concrete sub, you will know the subroutine that stores the bug. Search there and you will find it.

[email protected]


Many really silly things can cause this error. The one I've encountered is a font no longer included with Windows 8 by default - Courier New. The VB6 application had its name hard-coded in one of the forms, hence the message on start-up.


error 380 windows 7 solution very easy just check your date time & regional setting do them correct.