|
-
Aug 10th, 2006, 07:00 AM
#1
Thread Starter
Lively Member
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
Last edited by reisve; Aug 10th, 2006 at 07:15 AM.
-
Aug 10th, 2006, 07:04 AM
#2
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
-
Aug 10th, 2006, 07:18 AM
#3
Thread Starter
Lively Member
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
-
Aug 10th, 2006, 07:20 AM
#4
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.
-
Aug 10th, 2006, 07:24 AM
#5
Re: Invalid procedure call or argument... What is wrong with this code?
iprank is true
use
On Error Resume Next
-
Aug 10th, 2006, 07:28 AM
#6
Thread Starter
Lively Member
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
-
Aug 10th, 2006, 07:33 AM
#7
Re: Invalid procedure call or argument... What is wrong with this code?
wel
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|