Attribute VB_Name = "Module1"
Private Const FileName As String = "Données.don"
Private Const Delimiter As String = "$$"
Private fs As New FileSystemObject

Global cn As ADODB.Connection
Global rs As ADODB.Recordset
Global frame As Integer
Global propriete As String
Global utilisateur As String
Global mot_de_passe As String

Public Const LB_SELECTSTRING = &H18C
Public gFindString As String
Public Const gDataBaseName = "c:\DidactDB\Biblio.mdb"



Public Sub Main()


MDI.Show

Login.Show

'Flex.Show
'frmLogin.Show (1)
End Sub


Public Sub Enregistrer()
    
    
    Dim FileStream As TextStream
    Dim FilePath As String
    Dim Ligne As String
    Dim R As Long
    Dim c As Long
    
        
    FilePath = App.Path & "\" & FileName
    Set FileStream = fs.OpenTextFile(FilePath, ForWriting, True)
    
    For R = Flex.Grille.FixedRows To Flex.Grille.Rows - 1
        Ligne = vbNullString
        For c = Flex.Grille.FixedCols To Flex.Grille.Cols - 1
            Ligne = Ligne & Flex.Grille.TextMatrix(R, c) & Delimiter
        Next c
        Ligne = Left(Ligne, Len(Ligne) - Len(Delimiter))
        FileStream.WriteLine Ligne
    Next R
    
    FileStream.Close
    Set FileStream = Nothing
    Set fs = Nothing

End Sub

Public Sub Charger()
    
    Dim FileStream As TextStream
    Dim FilePath As String
    Dim Ligne As String
    Dim tabLigne() As String
    Dim R As Long
    Dim c As Long
    
    FilePath = App.Path & "\" & FileName
    Set FileStream = fs.OpenTextFile(FilePath, ForReading, False)
    
    R = Flex.Grille.FixedRows
    
        
    While Not FileStream.AtEndOfStream
        Ligne = FileStream.ReadLine
        tabLigne = Split(Ligne, Delimiter)
        c = Flex.Grille.FixedCols
        For c = Flex.Grille.FixedCols To Flex.Grille.Cols - 1
            Flex.Grille.TextMatrix(R, c) = tabLigne(c - Flex.Grille.FixedCols)
        Next c
        R = R + 1
    Wend
    
    FileStream.Close
    Set FileStream = Nothing

End Sub

Public Sub connection_DB()

    Set cn = New ADODB.Connection
    cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=bd2.mdb;Persist Security Info=False"
    cn.Open

End Sub
