08-06-16, 09:44 PM
كود :
Option Explicit
Private Sub Command1_Click()
Dim txt As String
Dim handle As Integer
handle = FreeFile
Open (App.Path & "\Data.txt") For Input As #handle
txt = Input$(LOF(handle), handle)
Close #handle
mySub txt
End Sub
Private Sub mySub(txt As String)
Dim mName As String
Dim mPhone As String
Dim mDate As String
Dim mFileName As String
Dim mFileSize As String
Dim mLines() As String: mLines = Split(txt, vbNewLine)
Dim i As Integer: For i = LBound(mLines) To UBound(mLines)
If Trim$(mLines(i)) <> "" Then
Dim t() As String: t = Split(mLines(i), ":")
If Trim(LCase(t(0))) = "name" Then mName = Trim$(t(1))
If Trim(LCase(t(0))) = "phone" Then mPhone = Trim$(t(1))
If Trim(LCase(t(0))) = "date" Then mDate = Trim$(t(1))
If Trim(LCase(t(0))) = "file name" Then mFileName = Trim$(t(1))
If Trim(LCase(t(0))) = "file size" Then mFileSize = Trim$(t(1))
End If
Next i
Me.Lbname.Caption = mName
Me.Lbphone.Caption = mPhone
Me.Lbdate.Caption = mDate
Me.Lbsize.Caption = mFileSize
Me.LbFile.Caption = mFileName
End Sub