ファイルの読込、保存


読込

 サンプルソース

Private Sub Command2_Click()
    
    Dim strBuff As String
    Dim strPath As String
    
    strPath = App.Path & "\List.txt"
    
    Open strPath For Input As #1
    
        Do Until EOF(1)
            Input #1, strBuff
            List1.AddItem strBuff
        Loop
        
    Close #1
    
End Sub

 


保存

 サンプルソース

Private Sub Command1_Click()
    
    Dim i As Integer
    
    Dim strBuff As String
    Dim strPath As String
    
    strPath = App.Path & "\List.txt"
    
    Open strPath For Output As #1
    
        strBuff = Format(Date, "yy/mm/dd") & " " & Format(Time, "hh:mm:ss")
        
        Write #1, strBuff
    
        For i = 0 To 10
        
            strBuff = "Write_data" & i + 1
            Write #1, strBuff
            
        Next i
        
        For i = 0 To 20
        
            strBuff = "Print_data" & i + 1
            Print #1, strBuff
            
        Next i
    Close #1
    
End Sub

ビジネスPC&PCサーバ


<戻る>

楽天モバイル[UNLIMITが今なら1円] ECナビでポインと Yahoo 楽天 LINEがデータ消費ゼロで月額500円〜!


無料ホームページ 無料のクレジットカード 海外格安航空券 解約手数料0円【あしたでんき】 海外旅行保険が無料! 海外ホテル