What causes this error? “Runtime error 380: Invalid property value”

前端 未结 13 1857
野的像风
野的像风 2020-12-18 00:21

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 comp

相关标签:
13条回答
  • 2020-12-18 01:05

    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.

    0 讨论(0)
提交回复
热议问题