Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
binary classes
#1
I have problem with my binary classes , i got that error "wrong number of arguments or invalid property assignment" and highlights FileExist on saveclasses sub.
Here is my code:

loadclasses sub
Code:
Sub LoadClasses()
Dim FileName As String
Dim i As Long
Dim nFileNum As Integer

    Call CheckClasses
    
    FileName = App.Path & "/classes.fcl"
    
    nFileNum = FreeFile
    Open FileName For Binary As #nFileNum
    
    Get #nFileNum, , Max_Classes
    
    ReDim Class(0 To Max_Classes) As ClassRec
    
    Call ClearClasses
    
    For i = 0 To Max_Classes
        Get #nFileNum, , Class(i)
        If (i Mod 5) = 0 Then DoEvents
    Next i
    
    Close #nFileNum

End Sub

saveclasses

Code:
Sub SaveClasses()
Dim FileName As String
Dim i As Long
Dim nFileNum As Integer

    FileName = App.Path & "\classes.fcl"
    
    nFileNum = FreeFile
    If FileExist(FileName, True) Then Kill FileName
    Open FileName For Binary As #nFileNum
    
    Put #nFileNum, , Max_Classes
    
    For i = 0 To Max_Classes
        Put #nFileNum, , Class(i)
    Next i
    
    Close #nFileNum

End Sub

checkclasses

Code:
Sub CheckClasses()
    If Not FileExist("\classes.fcl") Then
        Call ClearClasses
        Call SaveClasses
    End If
End Sub
Reply
#2
It's exacly what it says...
"wrong number of arguments or invalid property assignment"
Wrong number of arguments... There is needed only one argument not two, remove that ", True"...
Reply
#3
now i have RTE 52 in this
Code:
Function FileExist(ByVal FileName As String) As Boolean
    If Dir(App.Path & "\" & FileName) = "" Then
        FileExist = False
    Else
        FileExist = True
    End If
End Function
Reply
#4
At SaveClasses sub, replace "FileName = App.Path & "\classes.fcl"" with "FileName = App.Path & "classes.fcl""
Just remove the \, the function already adds it so your making a double \(\\)
Reply
#5
still the same problem RTE 52"bad file or number" i also removed the / in loadclasses and checkclasses but same problem,,,
Reply
#6
No... only one of them...
If that doesn't work, well...
Oh, just saw... remove the App.Path from the "FileName = App.Path & "/classes.fcl""
Just use:
FileName = "classes.fcl"
That's how the function works
Reply
#7
Thanks it works i dont have an error server loads normally.Should i change the loadclasses as well?
Reply
#8
It will probably bug too...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)