Invalid procedure call or argument... What is wrong with this code?
Hi I have this code:
VB Code:
1 Private Sub Form_Resize()
2 If UseCommBox <> 0 Then
3 txtTerm.Move 0, 0, frmTerminal.ScaleWidth, frmTerminal.ScaleHeight - sbrStatus.Height - txtSendText.Height
4 txtSendText.Move 0, txtTerm.Height, frmTerminal.ScaleWidth, 315
5 ElseIf UseCommBox = 0 Then
6 txtTerm.Move 0, 0, frmTerminal.ScaleWidth, frmTerminal.ScaleHeight - sbrStatus.Height
7 End If
8 End Sub
everytime I ru the application, the form resizes ok, but gives me this error message:
Run-time error '5':
Invalid procedure call or argument
Any ideas why?
Thanks
Virginio
Re: Invalid procedure call or argument... What is wrong with this code?
in which line nwhat is the txtterm and use combio give all detail
Re: Invalid procedure call or argument... What is wrong with this code?
txtTerm and txtSendText are texbox controls; sbrStatus is a StatusBar; UseCommBox is a variable which can be 0 or something else.
The errors ocur on lines 3 or 6 depending on the UseCommBox
Re: Invalid procedure call or argument... What is wrong with this code?
Most likely the value for new Width or Height is becoming negetive.
Add a break point at the beginning of the sub and check the values in every line step by step by pressing F8.
To overcome this type off errors, it is recommended to use On Error Resume Next in Form_Resize.
Re: Invalid procedure call or argument... What is wrong with this code?
iprank is true
use
On Error Resume Next
Re: Invalid procedure call or argument... What is wrong with this code?
well, on error resume next took care of the error message. And since the form resizes ok, I think it resolved
Thank You guys
Re: Invalid procedure call or argument... What is wrong with this code?
wel
Quote:
l, on error resume next took care of the error message. And since the form resizes ok, I think it resolved
Thank You guys
When you have received an answer to your question, please mark it as Resolved using the Thread Tools menu.