Attribute VB_Name = "Module4"
Option Explicit

Type tClient
    Num As String * 3
    X As String * 10
    Y As String * 10
    Type As String * 10
End Type


' Filter
Public Const filtre_champ = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*|"


Public Function Ouvrir_Document()
    
       
    ' ouvrir un document existant
    On Error GoTo OpenError
       
    Dim Fichier_Nom As String
    Dim Data As String
    Dim chaine(200) As String
    
    Dim nbre_ligne As Integer
    Dim position As Integer
    
    
    nbre_ligne = 1
        
    With Prog_Frm
        .CmDlg.CancelError = True
        .CmDlg.DialogTitle = "Selection du fichier à ouvrir"
        .CmDlg.Filter = filtre_champ
        .CmDlg.FilterIndex = 1
        .CmDlg.ShowOpen
   End With
       
   Fichier_Nom = Prog_Frm.CmDlg.FileName

   ' lecture du fichier
   Open Fichier_Nom For Input As #1
   
  
 ' Dim intFic As Integer
'Dim client As tClient
'intFic = FreeFile
'Open "c:\pad.txt" For Random As intFic Len = Len(client)
'Get intFic, 1, client
'MsgBox client.Num
'Get intFic, 2, client
'MsgBox client.Num
'Close intFic
  
  Dim temp As String
  
  
   While Not EOF(1)
   Input #1, Data$
   NB_PAD = NB_PAD + 1
   chaine(nbre_ligne) = Data$  ' + Chr$(13) + Chr$(10)
   '
   position = InStr(chaine(nbre_ligne), " ")
    
    
   nbre_ligne = nbre_ligne + 1
   Wend
   
  Close #1
   
    
OpenError:
    
    'If Err.Number = 32755 Then Exit Function 'If canceled then exit function
    'ErrorLog "modDocument/OpenDocument"
End Function

Public Property Get CancelError() As Boolean
    CancelError = m_CancelError
End Property
Public Property Let CancelError(ByVal New_CancelError As Boolean)
    m_CancelError = New_CancelError
    PropertyChanged "CancelError"
End Property

Public Property Get Filter() As String
    Filter = m_Filter
End Property
Public Property Let filtre(ByVal New_Filter As String)
    m_Filter = New_Filter
    PropertyChanged "Filtre"
End Property
Public Property Get FilterIndex() As Integer
    FilterIndex = m_FilterIndex
End Property
Public Property Let FilterIndex(ByVal New_FilterIndex As Integer)
    m_FilterIndex = New_FilterIndex
    PropertyChanged "FilterIndex"
End Property
Public Property Get DialogTitle() As String
    DialogTitle = m_DialogTitle
End Property
Public Property Let DialogTitle(ByVal New_DialogTitle As String)
    m_DialogTitle = New_DialogTitle
    PropertyChanged "DialogTitle"
End Property

