Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Run-time Error 5:Invalid Procedure Call Or Argument


Hi guys,
Could anyone please explain what are the possible causes of 'Run-time error 5: Invalid procedure call or argument' in VB. I am using SaveSettings functions in my application. Is it because of registry???

Regards,
Swapna




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Run Time Error 5 Invalid Procedure Call Or Argument
Hi!
im recieving the run time error 5 invalid procedure call or argument i cant figure out why!

It highlights the following code "txtSurname.SetFocus"

Here is my Code in full.........
-----------------------------------------------------------------------
Sub SetActiveTextBoxes()
'**this procedure places an empty string into the textboxes if mstMode = "Add" and changes the
'**backColor and foreColor and unlocks the texboxes because they are now active.
For Each mcoControl In Me.Controls
If TypeOf mcoControl Is TextBox Then
If mstMode = "Add" Then
mcoControl.Text = ""
End If
If mstMode = "Search" Then
mcoControl.Text = ""
End If
mcoControl.Locked = False
mcoControl.BackColor = vbWhite
mcoControl.ForeColor = vbBlack
End If
Next mcoControl
'**Move the cursor to the second data entry textbox
txtSurname.SetFocus

End Sub
-----------------------------------------------------------------------
Ive tried putting in Me.Show before txtSurname.SetFocus... yet doesnt still doesnt work

I Appreciate your help...
Spiro

Run-time Error '5' Invalid Procedure Call Or Argument
Hi guys,

I have this problem with the above error:

I have one form that calls a password form. When the user clicks the "Cancel" button on the password form, the password form is unloaded. The return is sent to the first form, where I have an if...then statement to check whether the password has been entered, if not (in this case) I display a msgbox "Cancelled!"

However, before this msgbox is displayed, the above error occurs and the program terminates. This ONLY occurs once I have compiled to .exe

Any takes on how to overcome this?

Many thanks

Tweeg

Run-time Error '5': Invalid Procedure Call Or Argument
I get this error:

Run-time error '5': Invalid procedure call or argument

And when I click debug it highlights this line of code:
strEmail(lngCount) = Mid$(lstLoginsLoaded.List(lngCount), 0, intDelimChar - 1)

Anybody have a clue as to why?

Run-time Error 5:Invalid Procedure Call Or Argument
Hi guys,
Could anyone please explain what are the possible causes of 'Run-time error 5: Invalid procedure call or argument' in VB. I am using SaveSettings functions in my application. Is it because of registry???

Regards,
Swapna

Run Time Error 5 Invalid Procedure Call Or Argument
I have a form which has many controls

now one of the control is sft tree . which is like a table where u can define the columns so its a box in which u can have many colums

now i am trying to increase the size of the columns when the user maximizes the form.

but when i change the code to reflect the increased it then during run time it gives me the error : error 5 invalid procedure call or argument

here is a part of the code and the name of control i am tryong to change is

"PackageComponents" (its is at teh last)


VB Code:
Private Sub Form_Resize() If Me.WindowState = vbMaximized Then     MsgBox ("Maximised")     Else: MsgBox ("Minimised1")     End If         If Me.WindowState <> vbMinimized Then        fraMenuSeparator.Width = Me.Width + 50        fraProperties.Width = Me.Width - (fraProperties.Left * 2) - 100                lblTakedaContact.Left = lblCompound.Left        lblStudyNumber.Left = fraProperties.Width 2                cboCompound.Left = lblTakedaContact.Left + lblTakedaContact.Width + 120        cboCompound.Top = lblCompound.Top - 50        cboCompound.Width = lblStudyNumber.Left - cboCompound.Left - 200                lblStudyNumber.Top = lblCompound.Top        cboStudyNumber.Left = lblStudyNumber.Left + lblStudyNumber.Width + 100        cboStudyNumber.Width = fraProperties.Width - cboStudyNumber.Left - 200                cboServiceType.Left = cboCompound.Left        cboServiceType.Width = cboCompound.Width        cboServiceType.Top = cboCompound.Top + cboCompound.Height + 100                lblServiceType.Top = cboServiceType.Top + 50        lblServiceType.Left = lblTakedaContact.Left                lblStudyPhase.Left = lblStudyNumber.Left        lblStudyPhase.Top = lblServiceType.Top                cboStudyPhase.Top = cboServiceType.Top        cboStudyPhase.Left = cboStudyNumber.Left        cboStudyPhase.Width = cboStudyNumber.Width                txtTakedaContact.Left = cboCompound.Left        txtTakedaContact.Top = cboServiceType.Top + cboServiceType.Height + 100        txtTakedaContact.Width = cboStudyPhase.Left + cboStudyPhase.Width - txtTakedaContact.Left                lblTakedaContact.Top = txtTakedaContact.Top + 50                txtPackageName.Left = cboCompound.Left        txtPackageName.Width = txtTakedaContact.Width        txtPackageName.Top = txtTakedaContact.Top + txtTakedaContact.Height + 100                lblPackageName.Left = lblCompound.Left        lblPackageName.Top = txtPackageName.Top + 50                txtLocation.Top = txtPackageName.Top + txtPackageName.Height + 150        txtLocation.Left = cboCompound.Left        txtLocation.Width = txtPackageName.Width                lblLocation.Left = lblCompound.Left        lblLocation.Top = txtLocation.Top                cmdMore.Left = txtPackageName.Left + txtPackageName.Width - cmdMore.Width        cmdMore.Top = txtLocation.Top + txtLocation.Height + 70                fraProperties.Height = cmdMore.Top + cmdMore.Height + 150                lblPackageComponents.Left = fraProperties.Left        lblPackageComponents.Top = fraProperties.Top + fraProperties.Height + 300                cmdAdd.Left = lblPackageComponents.Left        cmdAdd.Top = lblPackageComponents.Top + lblPackageComponents.Height + 120                cmdRemove.Left = cmdAdd.Left        cmdRemove.Top = cmdAdd.Top + cmdAdd.Height + 100                cmdReplace.Left = cmdRemove.Left        cmdReplace.Top = cmdRemove.Top + cmdRemove.Height + 100                cmdCancel.Top = Me.Height - sbStatusBar.Height - cmdCancel.Height - 800        cmdCancel.Left = fraProperties.Left + fraProperties.Width - cmdCancel.Width                If cmdSave.Visible Then            cmdSave.Top = cmdCancel.Top            cmdSave.Left = cmdCancel.Left - cmdSave.Width - 120        End If           With PackageComponents            .Left = cmdAdd.Width + (cmdAdd.Left * 2)            .Width = fraProperties.Left + fraProperties.Width - .Left            .Top = lblPackageComponents.Top + lblPackageComponents.Height + 120            .Height = cmdCancel.Top - .Top - 120            MsgBox ("the column is called fisrt") [b]' i have changed this line[/b]               .columnwidth(0)  = 4000                MsgBox ("the column width has been increased")                    End With    End If

Run-time Error 5, Invalid Procedure Call Or Argument
I keep getting the above error, but when I run the code in debug mode the error doesn't show, so I haven't a clue what is generating the error.

Any ideas?

Run Time Error 5 - Invalid Procedure Call Or Argument
Everytime I try to run this line of code I get a RunTime Error 5 - Invalid procedure call or argument. Here it is. I have this code in another project and it works great. Any help would be appreciated. It bombs on the shell command.


Code:

strFileCopy = Trim(DataList1.Text)
Dim intRet As Integer

If strFilyCopy <> "" Then
intRet = Shell("\exchangedownload444" & strFileCopy, vbNormalFocus)
End If

VB “Run-time Error '5': Invalid Procedure Call Or Argument”
I need help with Visual Basic (VB) forms incorporated into a Microsoft Word (Word) template.
My departments currently using a Word template I created utilizing VB forms.
I recently updated the VB form on my template; improving features, adding functionality, etc., and sent this template out as an update.
The problems happens after I attach the new template (through Templates and Add-Ins feature) in documents created with old template:
I try to recall the form (using a macro) from within Word and, I get a VB “Run-time error '5': Invalid procedure call or argument” error .
I believe this is because the form has changed?
Is there some way to prevent these errors with future releases?
Essentially, I would like all forms on my templates to update seamlessly, regardless of the version used when created.
What do you think?

Run-time Error 5:Invalid Procedure Call Or Argument
Hi guys,
Could anyone please explain what are the possible causes of 'Run-time error 5: Invalid procedure call or argument' in VB. I am using SaveSettings functions in my application. Is it because of registry???

Regards,
Swapna

Run-time Error 5 (invalid Procedure Call Or Argument) - STUMPER
OK, I know this error can be caused a number of ways. For example, using the "Left" function with a negative number. Then you have the problem where you try to do a SetFocus on a control that is not visible or not enabled. What else might cause this error?

The situation is this: I have developed an app and it NEVER produces this error on my development box, be it in the IDE or running as an exe. BUT my client is getting this error INTERMITTENTLY and in different places in the app - from what they describe, when it occurs, it occurs when they try to switch from one form to another - AND it only occurs when running on a workstation. If the app is run directly from the server on which it is installed, the error does NOT occur.

What I've done so far to try and diagnose this thing is to add error-handling code in every sub or function that uses SetFocus (I normally only use error-handling in database and file-handling routines, so I guess I learned a little lesson here). However, they are still getting the "unhandled" version of this error, leading me to believe it is occurring in a routine that does NOT have SetFocus. My next step of course will be to add an Error handler in every stinking routine. While I'm working on that, does anyone have any clue as to what might be going on here, based on the information I have provided?

Thanks.

Run-time 5 Invalid Procedure Call Or Argument
Hello,



Code:
Dim strLicenseKey As String
Dim lngSerialNum As Long
strLicenseKey = CStr(Int(1234 * Sqr(lngSerialNum / 5)))


It shows an error: Run-time 5 Invalid procedure call or agument

why?

Thank you

Invalid Procedure Call Or Argument Error
I have an application that is using a File System Object to move files from one directory to another. This VB application is being executed through the SQL exec command via SQL job. I can execute the application successfully in IDE, in the compiled version, but every time the SQL job tries to execute the command, the error 5 Invalid Procedure Call or Argument is thrown. I can run a series of command in the application before the move command but as soon as I say oFSO.movefile(<filename>, <destinationname>) it throws that error. Any suggestions, clues?

It only throws the error with SQL job execution.

Thanks in advance!

Invalid Procedure Call Or Argument (Error 5)
I have an aplication visual basic 6.0 operating correctly in windows 98 and windows 2000, but I installed the aplication in a machine that uses windows xp and sometimes show this error.
Please help me.

Error 5 - Invalid Procedure Call Or Argument
After I added "On Error GoTo dbErr", I get an error when launchin the EXE (not if I run it from VB!)... The error is "run-time error 5. invalid procedure call or argument"... It doesn't get displayed in my "MsgBox Err.Number", it's a VB error... This error only shows when there is a msgbox in the dbErr:

If I remove the messagebox, the error doesn't show!


On Error GoTo dbErr
....
dbErr:
MsgBox Err.Number
If Err.Number = "-2147467259" Then
MsgBox "The database is currently locked." & vbCrLf & _
"Someone is adding a record." & vbCrLf & _
"Please try again in a few minutes.", vbCritical, _
"Critical Database Error"
Screen.MousePointer = vbDefault
Unload Me
End If


Any ideas?

thanks

Error: Invalid Procedure Call Or Argument
hi, everybody,


 i face a problem when i running my program.

 the error happend when i try to insert the data to the database, but in my database, there is a special character ~, after i change the character to - , then the program can run.

 i just want to know that, is it the character above will infect my program? or i got another error in my program?

 the error will look like below :
Code:BatchUtilityMgr.clsBatchUplMgr.mtdExeDUDataCmd    Invalid procedure call or argument    BatchUtilityMgr


BatchUtilityMgr.clsBatchUplMgr.mtdExeDUDataCmd this is my object name...


 i hope all the expert can help me..

 your help will be appreciate.

 thank you very much...

Invalid Procedure Call Or Argument - Where Could The Error Be Happening?
here is my code in winsock_close event


Code:
Dim strHttpResponseHeader As String
If Not m_bResponseReceived Then
strHttpResponseHeader = Left$(m_strHttpResponse, _
InStr(1, m_strHttpResponse, _
vbCrLf & vbCrLf) - 1)
Debug.Print strHttpResponseHeader
m_strHttpResponse = Mid(m_strHttpResponse, _
InStr(1, m_strHttpResponse, _
vbCrLf & vbCrLf) + 4)
mData = m_strHttpResponse
m_bResponseReceived = True
'addlog "Response completed"
End If
im getting a invalid procedure call or argument error in here somewhere, but where could it be occuring? i cant debug it, because it has to be run in an exe form when i catch the error

Runtime Error 5: Invalid Procedure Call Or Argument
I'm using Directdraw for a little game.

When a call

Set backsurf = ddraw.CreateSurfaceFromFile(App.Path + "imagesackground.bmp", ddsd2)

it don't work on one computer but on one other it work!!!

I have found that

ddsd2.lHeight can't be more than 768
and
ddsd2.lWidth can't be more than 1024 on the computer who don't run it
and throw me a Runtime Error 5: Invalid procedure call or argument

Can you help me,

Thanks

Avoiding Error With Mid: Invalid Procedure Call Or Argument
I am using the Mid function. This is real important, so I wanted to ask instead of just assuming.

In this example, tempstring can be anything (empty, big, whatever).

and
linesize-t+1 must be greater than or equal to 1. Is that correct? I want to avoid any illegal function calls.


Code:
Mid(tempstring, lineSize - t + 1, 1) = " " 'Invalid procedure call or argument

Invalid Procedure Call Or Argument Stupid Error
For some reason I receive an error when running the following code:

VB Code:
lstSites.AddItem Left(Bookmarks(i), DelimPoint)

I know that its out of context but I am sure that there is a simple way to sort this out. DelimPoint is a valid integer that is less than the length of Bookmarks(i).
Any help would be appreciated,

Code Error, Invalid Procedure Call Or Argument
Pushing this button twice gives me the error.


Quote:




Invalid procedure call or argument





VB Code:
Private Sub Command9_Click()If FileOpen = True Then Dim lngIndex As LongText2.Text = ""Text2.Visible = True    'move listbox to textbox    If List1.Visible = True Then        For lngIndex = 0 To List1.ListCount - 1        Text2.Text = Text2.Text & List1.List(lngIndex) & vbCrLf    Next     Text2.Text = Left$(Text2.Text, Len(Text2.Text) - 2)            List1.Clear   Else    'move listbox to textbox    For lngIndex = 0 To List2.ListCount - 1        Text2.Text = Text2.Text & List2.List(lngIndex) & vbCrLf    Next     Text2.Text = Left$(Text2.Text, Len(Text2.Text) - 2)    End If    Else    MsgBox "No file opened."    End IfEnd Sub

RunTime Error '5' Invalid Procedure Call Or Argument
I get a Run-time errror '5' Invalid procedure call or argument while invoking the SetFocus Method of a TextBox.
What is the problem here? But it works in some other project.

This Causes Error 5: Invalid Procedure Call Or Argument. [SOLVED]
VB Code:
Private Sub File1_OLEStartDrag(Data As DataObject, AllowedEffects As Long)    For i = 0 To File1.ListCount - 1        If File1.Selected(i) = True Then            [color=red]Data.SetData File1.Selected(i), vbCFFiles[/color]         End If    Next i    AllowedEffects = vbDropEffectCopyEnd Sub


The text in red is the code that raised the error. I included the entire sub in case the cause lied somewhere else within.

Invalid Procedure Call Or Argument (Error 5) When I Start SAP R/3
Dim stAppName

stAppName = Shell("C:Program FilesESOESAPGUISAPGUISapshcut.exe h:dataaccessP033.SAP", 1)
AppActivate stAppName

SendKeys "" & Forms![frmPIA]![Text51] & ""
SendKeys "{ENTER}"

Here I get error "Invalid procedure call or argument (Error 5)"

The program starts then the code stops on AppActivate stAppName. Why can't I do this with SAP R/3. It works if I do it in excel. I would be very greateful for help.
How should I do for start SAP and send some keys?
Is there anything else than SendKey I can use?

Runtime Error 5 - Invalid Procedure Call Or Argument
Hi I am having this error b/w MsgBox step 2 & MsgBox step 3 . Step 2 is displyed and then i am greeted with this error. If i run my program through the VB

the problem doesn't occur but after making exe file if i run it this problem occurs every time. I am using VB 6.0 on windows 2000.kindly advise.......

'############# find a well ################
Case cmdFind
Dim iReturn As Integer
gFindString = ""
With frmFind
.Caption = "Type Well Number to find"
' .recordSource = "SELECT API_Number FROM Wellbore_Data "
.Show vbModal
End With

iMsg = MsgBox("Step4 ", vbCritical, "Well Number")
If (Len(gFindString) > 0) Then
' Data1.UpdateControls
With Data1.Recordset
iMsg = MsgBox("Step5 ", vbCritical, "Well Number")
.FindFirst "API_Number = '" & gFindString & "'"
If (.NoMatch) Then
iReturn = MsgBox("Well Number " & gFindString & " was not found.", vbCritical, "Well Number")
Else
iReturn = MsgBox("Well Number " & gFindString & " was retrieved.", vbInformation, "Well Number")
txtAPI_Number.Text = gFindString
End If
End With
End If
updateButtons

Case cmdDone
Unload Me
End Select
End Sub
'########################### In the form find i have written this code

Private Sub Form_Activate() ' pg 249
List1.Enabled = False
dtaFind.DatabaseName = App.Path & "ColumbiaGas.mdb"
dtaFind.RecordSource = "SELECT API_Number FROM Wellbore_Data ORDER BY [Well]"
dtaFind.Refresh
If (dtaFind.Recordset.RecordCount > 0) Then
Screen.MousePointer = vbHourglass
dtaFind.Recordset.MoveFirst
While Not dtaFind.Recordset.EOF
List1.AddItem dtaFind.Recordset.Fields(0) & ""
dtaFind.Recordset.MoveNext
Wend
List1.Enabled = True
DoEvents
End If
lblCount = "There are " & dtaFind.Recordset.RecordCount & " Wells"
Screen.MousePointer = vbDefault

End Sub

Private Sub txtFind_Change() 'pg 252
Dim entryNum As Long
Dim txtToFind As String
txtToFind = txtFind.Text
entryNum = sendMessageByString(List1.hwnd, LB_SELECTSTRING, 0, txtToFind)
End Sub
Private Sub List1_DblClick() 'pg 253
' get the item the user clicks and asssign it
iMsg = MsgBox("Step1 ", vbCritical, "Well Number")
gFindString = List1
iMsg = MsgBox("Step2 ", vbCritical, "Well Number") ' ????????????????????????????????????????????
dtaFind.Recordset.Close
frmFind.Hide
Exit Sub
'Unload Me
iMsg = MsgBox("Step3 ", vbCritical, "Well Number")
End Sub
Private Sub cmdCancel_Click() ' pg 254
Unload Me
End Sub
Private Sub Form_Unload(Cancel As Integer)
'Set frmFind = Nothing
Unload Me
End Sub

' #######################I have defined following things in Global module

Public Declare Function sendMessageByString& Lib "user32" _
Alias "SendMessageA" (ByVal hwnd As Long, _
ByVal wMsg As Long, ByVal wParam As Long, _
ByVal lParam As String) ' pg 239
Public Const LB_SELECTSTRING = &H18C
Public gFindString As String
Public iMsg As Integer

I Get Error 5 - Invalid Procedure Call Or Argument, But Not When I Step Through
Hi I get an "Error 5 - Invalid procedure call or argument" when using the following code:
Code:Set ts = mFso.CreateTextFile(sFilePath & "zxq.qxz")
where mFso is a Scripting.FileSystemObject; ts is a TextStream; sFilePath is a string containing the value "A:" and there is no disk in the A drive.
I expect to get "Error 71 - Disk not ready".
When I step through the code I do not get Error 5, but instead get Error 71 like I expect to. However whenever I just run the application, I always get Error 5.

If sFilePath is a value that won't cause an Error 71 (such as "C:", which is my hard drive), no error 5 nor 71 is created, as expected.
I tried placing DoEvents either side of the function, but to no effect.

If your wondering why I'm trying to get an Error 71, it is so I can display a user friendly message,
letting them know there is no disk in the drive.

All help is greatly apprectiated.
Thanks.



Edited by - noraa on 4/17/2005 11:17:55 PM

SetWindowsPos API - Runtime Error 5 - Invalid Procedure Call Or Argument
I am getting a runtime error 5 " Inavalid procedure call or arguement" when calling setWindowPos() function in a VB6 application in Windowws xp. The window does resize and gets a new position but then the error is received.
Any input would be appreciated.
thanks



Edited by - breakfast3001 on 12/16/2004 1:38:40 PM

Run Time Error 5 Invalid Procedure 5 Or Argument
i tried this code but it has an error run time error 5 invalid procedure 5 or argument ....

Private Sub mnuEXE_Click()
Dim SelectedItem As String
'open file
SelectedItem = fileBox1.path

'checking if the path is correctly written (with the at the end)
If Not right(SelectedItem, 1) = "" Then SelectedItem = SelectedItem & ""

SelectedItem = SelectedItem & fileBox1.fileName
Shell "C:WindowsNotepad.exe" & """" & App.path & "logs" & fileBox1.fileName & """"
End Sub


thanks in advance

Invalid Procedure Call Or Argument
Can anyone tell why I am gettting this error while trying to set the focus to the textbox Paytxt.

Code:
Private Sub Form_Load()

Call Format

End Sub
_________________________________________________________________

Private Sub Format()

Dim i As Integer

With PayRecordGrid
.Row = 0
.Col = 0
.Text = "Date"
.Row = 0
.Col = 1
.Text = "Payment"
.ColWidth(0) = 1600
.ColWidth(1) = 1732

For i = 0 To 1
.ColAlignment(i) = flexAlignCenterCenter
Next i
End With

Paytxt.SetFocus

End Sub

Invalid Procedure Call Or Argument
I'm getting a runtime error '5': Invalid procedure call or argument - from an executable I created from a VB project that works OK in the Development environment. I have not seen this error and have recompiled and recreated the executable many times. Seems to be something that has happend after the year has rolled.

Thanks for the help!

Invalid Procedure Call Or Argument
Acctually we are developing Payroll Software using storeprocedure for generating salary with VB6 & MYSQL5.0 Database.

We are using batch file which calls the store procedure script from the VB Application to generate. but that time am getting error "Invalid procedure call or argument" , I think its not taking the batch file from VB Application some times.

If we run the batch file from outside(means not from the VB Application) its running fine and calling store procedure is fine..

please check the attachment which I run the store procedure script from calling batch file to run the SP from VB Application

In the Batch File i had given mysql -u root -ppasswd dbname < spname.txt
In spname.txt -> given as call generatesalary(); exit;

Invalid Procedure Call Or Argument
I am getting an invalid procedure call or argument error when I bring up a form. I was working fine until I added the code into my form_load event (except for the first line). This is what I have, and the error shows on the highlighted line. Please advise as to what I should do:

VB Code:
Option Explicit Private Sub Form_Load()    CenterForm Me     m_intFF = FreeFile    m_strFileName = App.Path & "/" & "DBCon" & m_strProjectFileNameExt            Open m_strFileName For Input As #m_intFF        Do Until EOF(m_intFF)            Line Input #m_intFF, m_strLine                m_strParts = Split(m_strLine, "|")                    For m_intSection = 0 To 7                        With frmOptions                            .txtOptionsServerIPAddress(0) = m_strParts(0)                            .txtOptionsServerIPAddress(1) = m_strParts(1)                            .txtOptionsServerIPAddress(2) = m_strParts(2)                            .txtOptionsServerIPAddress(3) = m_strParts(3)                            .txtOptionsDatabaseUsername.Text = m_strParts(4)                            .txtOptionsDatabasePassword.Text = m_strParts(5)                            .txtOptionsDatabaseName.Text = m_strParts(6)                        End With                    Next m_intSection                Loop    Close #m_intFFEnd Sub Private Sub chkDatabaseHasBeenSetup_Click()    If chkDatabaseHasBeenSetup.Value = vbChecked Then        fraOptionsDatabaseLoginCredentials.Enabled = False        fraOptionsServerIPAddress.Enabled = False        txtOptionsDatabaseName.Text = vbNullString        txtOptionsDatabaseUsername.Text = vbNullString        txtOptionsDatabasePassword.Text = vbNullString        txtOptionsServerIPAddress(0).Text = vbNullString        txtOptionsServerIPAddress(1).Text = vbNullString        txtOptionsServerIPAddress(2).Text = vbNullString        txtOptionsServerIPAddress(3).Text = vbNullString        cmdTestDBConnection.Enabled = False        cmdImportDatabaseConnectionString.Enabled = True    Else        fraOptionsDatabaseLoginCredentials.Enabled = True        fraOptionsServerIPAddress.Enabled = True        cmdTestDBConnection.Enabled = True        cmdImportDatabaseConnectionString.Enabled = False    End IfEnd Sub Private Sub cmdImportDatabaseConnectionString_Click()    On Error GoTo Cancel_Clicked        With cdlgImportDatabaseFile        .CancelError = True        .DialogTitle = "Import Database Connection Settings"        .Filter = "Database File (*" & m_strProjectFileNameExt & ")|*" & m_strProjectFileNameExt        .InitDir = "C:"        .ShowSave        m_strFileName = .FileTitle                FileCopy m_strFileName, App.Path & "" & m_strFileName                DatabaseFileImportCheck    End With        Exit SubCancel_Clicked:    'show no error messagesEnd Sub Private Sub cmdTestDBConnection_Click()    On Error GoTo Connection_Error        Set m_ADOCon = New ADODB.Connection        m_ADOCon.CursorLocation = adUseClient    m_ADOCon.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};" _                              & "SERVER=" & txtOptionsServerIPAddress(0).Text & "." & _                                txtOptionsServerIPAddress(1).Text & "." & _                                txtOptionsServerIPAddress(2).Text & "." & _                                txtOptionsServerIPAddress(3).Text & ";" _                              & "DATABASE=" & txtOptionsDatabaseName.Text & ";" _                              & "UID=" & txtOptionsDatabaseUsername.Text & ";" _                              & "PWD=" & txtOptionsDatabasePassword.Text & ";" _                              & "OPTION=" & 3                                  OpenDatabaseConnection        MsgBox "Connection to the database" & vbNewLine & _           "was successful!", vbInformation, "Connection Successful."                   m_ADOCon.Close        Set m_ADOCon = Nothing            Exit SubConnection_Error:    If Err.Number = -2147467259 Then        MsgBox "Connection to the database" & vbNewLine & _               "was unsuccessful!", vbExclamation, "Connection Unsuccessful."    End IfEnd Sub Private Sub cmdCancel_Click()    Unload MeEnd Sub Private Sub cmdOK_Click()    'End Sub Private Sub txtOptionsDatabaseName_GotFocus()    HighlightTextBoxContents txtOptionsDatabaseNameEnd Sub Private Sub txtOptionsDatabasePassword_GotFocus()    HighlightTextBoxContents txtOptionsDatabasePasswordEnd Sub Private Sub txtOptionsDatabaseUsername_GotFocus()    HighlightTextBoxContents txtOptionsDatabaseUsernameEnd Sub Private Sub txtOptionsServerIPAddress_Change(Index As Integer)    With txtOptionsServerIPAddress(Index)        If Not chkDatabaseHasBeenSetup.Value = vbChecked Then            If Not IsNumeric(.Text) Then                MsgBox "You can only input numbers for an IP address.", vbCritical, "Number Input Only."                HighlightTextBoxContents txtOptionsServerIPAddress(Index)                .BackColor = vbRed                Exit Sub            Else                .BackColor = &H8000000F            End If        End If            If Len(.Text) = .MaxLength Then            [hl]txtOptionsServerIPAddress((Index + 1) Mod txtOptionsServerIPAddress.Count).SetFocus[/hl]            .BackColor = &H8000000F        End If    End WithEnd Sub Private Sub txtOptionsServerIPAddress_LostFocus(Index As Integer)    With txtOptionsServerIPAddress(Index)        If Not IsNumeric(.Text) Then            .BackColor = vbRed        Else            .BackColor = &H8000000F        End If    End WithEnd Sub Private Sub txtOptionsServerIPAddress_GotFocus(Index As Integer)    With txtOptionsServerIPAddress(Index)        .SelStart = 0        .SelLength = Len(.Text)    End WithEnd Sub

Invalid Procedure Call Or Argument.
Hi, why does the .SetFocus method raise the following error :
Invalid procedure call or argument.


VB Code:
Private Sub Timer3_Timer()Me.text4.Enabled = TrueMe.text4.SetFocusMe.Timer3.Enabled = FalseEnd Sub

tia
Regards
Jorge

Invalid Procedure Call Or Argument!
In a VB6 project, users can set a password. Users have also been given the option to change their password. The Form where the password can be changed is named frmChangePwd. This is how frmChangePwd gets invoked:

-a menu is clicked in the start-up Form which is named frmMain.

-another Form named frmOptions gets loaded which has a CommandButton.

-clicking the CommandButton invokes another Form named frmCheckPwd where in the user will enter his existing password in a TextBox.

-if the password is correct, another Form named frmSettings gets invoked which has a CommandButton clicking which invokes frmChangePwd.

frmChangePwd has 3 TextBoxes named Text1, Text2 & Text3. To change a password, users have to enter their existing password in Text1, type a new password in Text2 & finally confirm the password typed in Text2 by retyping it in Text3. When a OK CommandButton is clicked, the password will be changed. This is how I have done it:
VB Code:
Private Sub cmdOK_Click()    Dim strPassword As String     'doing the necessary validations & finally saving the password in the Registry    strPassword = Text2.Text    SaveSetting "MyApp", "Settings", "Password", strPassword    [b]Unload Me[/b]    MsgBox "Your password has been changed successfully!"End Sub
Note that I want to first unload frmChangePwd & then show a MsgBox to the user stating that his password has been changed.

Now when I run the above code from the VB IDE & change the password, the above code gets executed successfully without generating any errors but when I compile the project into an EXE & then try to change the password by running the EXE, though the password gets changed successfully, the Invalid procedure call or argument error gets generated after which the app terminates.

After a few experimentations in the code, I realized that the Unload Me line in the above code (which is bold) is the culprit. If Unload Me is removed from there & added after the MsgBox line, then the EXE doesn't generate the above-mentioned error.

Now why is Unload Me generating the error only in the EXE & not in the VB IDE? How do I overcome this error in the EXE since as already mentioned, I want to first unload frmChangePwd & then show a MsgBox to the user stating that his password has been changed?

Invalid Procedure Call Or Argument?
whenever i try to run a second instance of my App i get this error

mycode is:

VB Code:
Let App.Title = App.Title & " V" & App.Major & "." & App.Minor & "." & App.Revision    Let Caption = App.Title        If App.PrevInstance Then        Call AppActivate(App.Title)        Call Unload(Me)        Exit Sub    End If

Invalid Procedure Call Or Argument.
Ok, while trying to use this AIM conversation saver, I've run into a wall.

If you run the program, and then open a new IM window, you get the error mentioned in my topic. Invalid procedure call or argument.

The line is:

VB Code:
strName = Left(oAIMWindow(x), intLen)


And I'll get the link to the source in a second.
http://vbforums.com/attachment.php?s=&postid=1294023

Thats the source

The reason is, when you start a new IM conversation, the windows' title is JUST "Instant Message" and not "Screenname:Screenname - Instant Message"

Invalid Procedure Call Or Argument
On our xp machines we recive an error "Invalid procedure call or argument", but it works on our windows 2000 machines.

When i debugg the application on win xp machine i recive the error message after CODEtextSearchEntry.Setfocus

Invalid Procedure Call Or Argument
The following code gives me this error, but I can't find any reason why. It even finishes what it's supposed to do before I get told about the error. It's probably something really simple but I can't figure it out... help please

Code:
Dim chars(1 To 16) As Integer, count As Integer, output(1 To 16) As String
count = 1
Do Until count = 16
    chars(count) = Asc(Mid(txtInput.Text, count, 1)) + (2 * count)
    output(count) = Chr(chars(count))
    txtOutput.Text = txtOutput.Text & output(count)
    count = count + 1
Loop




Edited by - jamief on 10/27/2004 11:32:08 AM

Error "invalid Procedure Call Or Argument"
what wrong for my code? when i open the "SampleExtract.txt", it work well. But, when i open the "Output.txt". it came out an error "invalid procedure call or argument"

i have attach the code and the two text file. Can somebody help me to find out the problem. thanks.

Another Invalid Procedure Call Or Argument Problem...
Doing some syncing on the serial port. Here is the code:


Quote:




Dim testflag As Integer
Dim InStrings As String
Dim InputTest As Integer
testflag = 0
MSComm1.InputLen = 1

Do While MSComm1.InBufferCount < 10
DoEvents
Loop

Do While syncflag = 0
InStrings = MSComm1.Input
InputTest = Asc(Mid(InStrings, 1, 1))
If InputTest = 1 Then
InStrings = MSComm1.Input
InputTest = Asc(Mid(InStrings, 1, 1))
If InputTest = 1 Then
syncflag = 1
MSComm1.InputLen = 8
InStrings = MSComm1.Input
End If
End If
Loop

Do While MSComm1.InBufferCount < 10 'wait for the buffer to start filling
If testflag = 0 Then
txtRawData.Text = "We are now in the main waitscan" + vbCrLf + txtRawData.Text
testflag = 1
End If
DoEvents
Loop




I am dying here: InputTest = Asc(Mid(InStrings, 1, 1))

And it looks like InStrings is "" or a null.

Really Annoying Invalid Procedure Call Or Argument
This is so pissing me off!

Can anyone figure out what the heck is going on here?

As you can see in the attached screen capture, the error is being raised on the highlighted line in the code. But what is causing the error?! If you look at the Immediate Window, you can see that I can take the contents of the variable, "Righto_PREP1" and raise it to the "LoftExp" power with no problem. But when I try to simply let it do the operation as shown in the Code Window, it fails. All of my variables are double precision as you can see, and there are no reserved words being used as variable names.

I'm stumped!

Many thanks for any replies.

Shell Invalid Procedure Call Or Argument
I run the below code

vbcode Code:
Private Sub lblDemo_Click()
Shell App.Path & "Demosetup.exe"
End Sub

I got the error Invalid Procedure Call or argument. No it is not File not found.
I also made an exe from the above code was placed it one level higher to Demo folder which contains setup.exe

Another question
In the same application

Vbcode Code:
Private Sub lblGuide_Click()
    Shell "C:Program FilesInternet Exploreriexplore.exe " & App.Path & "HelpHelp.htm", vbMaximizedFocus
End Sub

can we make this line more dynamic C:Program FilesInternet Exploreriexplore.exe "
Pls also see the error message in the attachment what is wrong?

SetFocus - Invalid Procedure Call Or Argument?
I have this in my code:
[highlight=VB]
lstWordFile.SetFocus
[/vbcpde]

and when running the program, I get that wonderful error (Invalid procedure call or argument).

I am sure it is something so simple..>

Dir() Giving Invalid Procedure Call Or Argument
Hi again

Hope everyone had a good weekend!

I have an import procedure that imports two slightly different .txt files from 2 different file locations. To cycle through the files in each folder, I user "strFileName = Dir()" because I will already have moved the previous file to an archive folder.

Basically, this is how the code looks:

Code:
strImportFile = Dir(strInputFolderPath & "*.*")
strMPEImportFile = Dir(strMPEInputFolderPath & "*.*")

While strImportFile <> ""
'do the imports and formatting here
'Move current file to a different location
strImportFile = Dir() 'This one always works with no probs.
wend

While strMPEImportFile <> ""
'do the imports and formatting here
'Move current file to a different location
strMPEImportFile = Dir() 'This one gives me the error
wend


... and the error I get is err.number = 5, err.description = "Invalid procedure call or argument".

This code was originally written by someone else and I am trying to adapt it for the second import. It works if the first import doesn't find any files so I am thinking that there is something I need to do with Dir() that I have not.

Could anyone help?

thx all
Greyson

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 Then3      txtTerm.Move 0, 0, frmTerminal.ScaleWidth, frmTerminal.ScaleHeight - sbrStatus.Height - txtSendText.Height4       txtSendText.Move 0, txtTerm.Height, frmTerminal.ScaleWidth, 3155    ElseIf UseCommBox = 0 Then6       txtTerm.Move 0, 0, frmTerminal.ScaleWidth, frmTerminal.ScaleHeight - sbrStatus.Height7     End If8 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

Shell Wont Run Invalid Procedure Call Or Argument
I am a bit more advanced than this, but it is so simple, I know. What's the issue?

I have a script, and it consists of Oh-So-Much:


Code:


Private Sub Form_Load()
Shell ("Shell/BatchFile.bat")
End Sub



I get the whole "Invalid Procedure call or argument" Run-Time Error 5 junk

The Batch File is empty. So there is nothing to give an error.
VB6 Enterprise

Resize Event: Invalid Procedure Call Or Argument
I have an MDI child form that contains a map object, a legend object, and several text boxes and combo boxes. When the MDI child form is called by the parent the child form is maximized. The Resize event handles the positioning an size of all the object on the form as it opens. Here is my problem: When I Minimize the application I get an error message stating, "Invalid procedure call or argument". If I comment out all the Move methods for the text boxes and combo boxes, but leave the map and legend Move methods uncommented I can Minimize the application with no errors. As soon as I uncomment the first text box's Move method I get the error. How can I fix this?

Add Stdpic To Byte Buffer (Invalid Procedure Call Or Argument)
When I try to execute this code..


Code:


Dim oNewMsg() As Byte

lOffset = NewBuffer(oNewMsg)


Call keybd_event(vbKeySnapshot, 1, 0, 0)
Dim stdpic As StdPicture

Set stdpic = Clipboard.GetData(vbCFBitmap)
Dim length As Long
Dim b() As Byte
length = GetPictureBits(b, stdpic)
AddDataToBuffer oNewMsg, length, LenB(length), 0
AddDataToBuffer oNewMsg, stdpic, length, LenB(length)

dps.SendTo DPNID_ALL_PLAYERS_GROUP, oNewMsg, 0, DPNSEND_NOLOOPBACK
I get an invalid procedure call or argument run time error on the 2nd addDataToBuffer call.

GetPictureBits returns the length of the byte buffer of the picture, and therefore the size of the picture in bytes - right?

Anyway, length tends to be around 800,000 bytes. I can't find any documentation on adddatatobuffer. I have no idea what to do, please help. Thanks

~Adams555~

Another Error: Invalid Call Or Argument And Others
i have 25 textbox control - all these of which loan amount, irates, loan duration have to be entered...

now, my dilemma is: an employee can actually avail all loans (6 at the maximum), but the thing is, what if there's only one loan an employee applied for?

i have all the computations set for the employee for all six loans... and automatically when no amount is entered on the textbox (meaning employee has no loan application for that certain loan), there's nothing to compute and error occur, so what do i do? how do i only come up with loans to compute wherein that employee has a loan and disregard computing the loans which he didn't make?

tnx.

Copyright © 2005-08 www.BigResource.com, All rights reserved