Error : Not a legal OleAut date.-VBForums
Results 1 to 5 of 5

Thread: Error : Not a legal OleAut date.

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2012
    Posts
    24

    Error : Not a legal OleAut date.

    I get this error when i try to drag a record from a file;

    Code:
        Private Sub cboBookingID_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboBookingID.Click
    
            Me.cboBookingID.Items.Clear()
            'output all records method 1
            NumberOfRecords = LOF(4) / Len(OneBooking)
            For Index = 1 To NumberOfRecords
                FileGet(4, OneBooking, Index)
                If OneBooking.Deleted = False Then
                    Me.cboBookingID.Items.Add(Index)
                End If
            Next Index
    
    
        End Sub
    The bit in bold is where the error crashes at. Any idea why it crashes, it because i used this code for like 5 other files and worked perfectly fine.

  2. #2
    PowerPoster kevininstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    5,680

    Re: Error : Not a legal OleAut date.

    Quote Originally Posted by Barhuumi View Post
    I get this error when i try to drag a record from a file;

    Code:
        Private Sub cboBookingID_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles cboBookingID.Click
    
            Me.cboBookingID.Items.Clear()
            'output all records method 1
            NumberOfRecords = LOF(4) / Len(OneBooking)
            For Index = 1 To NumberOfRecords
                FileGet(4, OneBooking, Index)
                If OneBooking.Deleted = False Then
                    Me.cboBookingID.Items.Add(Index)
                End If
            Next Index
    
    
        End Sub
    The bit in bold is where the error crashes at. Any idea why it crashes, it because i used this code for like 5 other files and worked perfectly fine.
    As with your other post, consider better explaining the problem and code. Seeing you are using obsolete methods and more likely than not have Option Strict Off all the more important you provide more details.

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2012
    Posts
    24

    Re: Error : Not a legal OleAut date.

    Quote Originally Posted by kevininstructor View Post
    As with your other post, consider better explaining the problem and code. Seeing you are using obsolete methods and more likely than not have Option Strict Off all the more important you provide more details.
    Sorry, i thought it was pretty self explanatory, and didn't explain the code since i used it over 10 times in this project. I was asking what the error was or what it meant since i have never come across it before.. but sure i'll break down the code for you.

    Code:
            Me.cboBookingID.Items.Clear() 'Clears combo box.
            'output all records method 1
            NumberOfRecords = LOF(4) / Len(OneBooking)
            For Index = 1 To NumberOfRecords ' Loops thorough all records in file.
                FileGet(4, OneBooking, Index) 'gets record one by one.
                If OneBooking.Deleted = False Then 'Only finds records that isn't deleted.
                    Me.cboBookingID.Items.Add(Index) 'Then adds the record to the combo box.
                End If
            Next Index
    Now that worked for me a coupla times, but what i don't get is why it crashes all of a sudden, and what the error means.

  4. #4
    PowerPoster kevininstructor's Avatar
    Join Date
    Jun 2008
    Location
    Oregon
    Posts
    5,680

    Re: Error : Not a legal OleAut date.

    Okay next question, I am not a VB6 programmer I have never used FileGet. So what does the file content look like, is it a structured text file or binary?

  5. #5
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    4,938

    Re: Error : Not a legal OleAut date.

    Quote Originally Posted by kevininstructor View Post
    Okay next question, I am not a VB6 programmer I have never used FileGet. So what does the file content look like, is it a structured text file or binary?
    It looks like he is attempting to enumerate several records in a binary file. Each record would be of type OneBooking. This was a pretty common way to store data in VB6 and Ad-hoc databases were made and read in this way in QuickBasic.

    The members would be layout in much the same manner as a sequential structure in memory with padding and alignment and so on.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena


    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. -jmcilhinney

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.