1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
imports system.IO
Public Structure batiment
Dim numeroprod As Integer
Dim levelbat As Byte
Dim zone As Byte
Dim tempsprod As DateTime
Dim valide As Byte
<VBFixedString(200)> Dim chaine As String
End Structure
Public libre As Long = 0
Public nomflile As String = My.Application.Info.DirectoryPath & "\base.bdd"
Public rlile As batiment
Dim reclong As Long = Len(rlile)
Public longflile As Long = 0
sub
libre = FreeFile()
FileOpen(libre, nomflile, OpenMode.Random, OpenAccess.ReadWrite, OpenShare.Shared, reclong)
longflile = FileLen(nomflile) / reclong
If longflile <= 0 Then Exit Sub
Dim vijk As Long = 0
For vijk = 1 To tbatile ' contient le nombre de batiments à sauvegarder
'expres je n'assigne pas les champs de la structure pour alleger le code
FilePutObject(libre, rlile) ' c'est ici que ca coince
Next
FileClose(libre)
End Sub |
Partager