HomeVisual Basic技術項目 ファイル読込み、書込み

ファイル読込み、書込み

ファイル読込み

Private Sub ReadFile(ByRef file_path As String)

    Dim sr As New System.IO.StreamReader(file_path, System.Text.Encoding.GetEncoding(932))
    '内容を一行ずつ読み込む
    While sr.Peek() > -1
        MessageBox.Show(sr.ReadLine())
    End While

    '閉じる
    sr.Close()

End Sub

ファイル書込み

Private Sub WriteFile(ByRef file_path As String)

    Dim sw As New System.IO.StreamWriter(file_path, False, System.Text.Encoding.GetEncoding(932))

    '書込む
    sw.Write("書込む内容")

    '閉じる
    sw.Close()

End Sub



ページトップへ

データベース

サーバ

Copyright (C) MadCap. All Rights Reserved.