Hi there, i am getting the following error on my computer program i have created using VB.net 2005: 'Not a legal OleAut date.'
This code which this is arising from is the following part of the function: FileGet(1, OneClient, Index)
This is the whole function which attempts to store data and display it in a listbox:
Private Sub btnListRecords_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnListRecords.Click
Dim Index As Integer
lstClients.Items.Clear() 'clears items from listbox
FileOpen(1, Filename, OpenMode.Random, , , Len(OneClient)) 'opens Clients.dat file
NumberOfRecords = LOF(1) / Len(OneClient)
For Index = 1 To NumberOfRecords
FileGet(1, OneClient, Index) 'gets first record in file
lstClients.Items.Add(String.Format(MyFormat, _
OneClient.Name, OneClient.Address, OneClient.Postcode, OneClient.Age, OneClient.TypeOfDeal, OneClient.Mode, OneClient.LessonsHad, _
Format(OneClient.Cost, "currency"), _
OneClient.Paid, OneClient.Attended, OneClient.Contact, OneClient.NextLessonDueDate))
'the code above displays items (records) in a list box
Next Index ' the file gets the next record in file and this process is repeated until end of records or no records are found
FileClose() 'the file Clients.dat is closed
End Sub
I think its something to do with the format of the date, because i am trying to store a date in a listbox.
Any suggestions?
Regards
Shyam
This code which this is arising from is the following part of the function: FileGet(1, OneClient, Index)
This is the whole function which attempts to store data and display it in a listbox:
Private Sub btnListRecords_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnListRecords.Click
Dim Index As Integer
lstClients.Items.Clear() 'clears items from listbox
FileOpen(1, Filename, OpenMode.Random, , , Len(OneClient)) 'opens Clients.dat file
NumberOfRecords = LOF(1) / Len(OneClient)
For Index = 1 To NumberOfRecords
FileGet(1, OneClient, Index) 'gets first record in file
lstClients.Items.Add(String.Format(MyFormat, _
OneClient.Name, OneClient.Address, OneClient.Postcode, OneClient.Age, OneClient.TypeOfDeal, OneClient.Mode, OneClient.LessonsHad, _
Format(OneClient.Cost, "currency"), _
OneClient.Paid, OneClient.Attended, OneClient.Contact, OneClient.NextLessonDueDate))
'the code above displays items (records) in a list box
Next Index ' the file gets the next record in file and this process is repeated until end of records or no records are found
FileClose() 'the file Clients.dat is closed
End Sub
I think its something to do with the format of the date, because i am trying to store a date in a listbox.
Any suggestions?
Regards
Shyam