Membuat file txt di vb6

membuat file txt pada vb 6
Private Sub cmdcreate_log_Click()
 Dim pathh As String

'open "C:\Users\TAUFIK\Downloads\Compressed\ada\tesasast.txt", Text2.Text
Dim ff As Integer
ff = FreeFile()
Dim tanggal As String
Dim hari As String
Dim bulan As String
Dim tahun As String
 tahun = Format(Now, "yyyy")
 bulan = Format(Now, "mm")
 hari = Format(Now, "dd")
 tanggal = tahun + bulan + hari
pathh = "F:\Ilmu\chat vb\filenya\"
   Dim aaa As String
   aaa = tanggal + ".txt"

Open pathh & aaa For Append As #ff
Write #ff, Text2.Text
Close #ff
End Sub

cara open file txtnya
Private Function GetFileContents(ByVal file_name As String) As String
Dim fnum As Integer

    ' Open the file.
    fnum = FreeFile
    Open file_name For Input As fnum

    ' Grab the file's contents.
    GetFileContents = Input(LOF(fnum), fnum)

    ' Close the file.
    Close fnum
End Function

Private Sub cmdLoad_Click()
    txtFile.Text = GetFileContents(txtFilename.Text)
End Sub

*txtfile = tempat isi content nya
*txtfilename = tempat path nya

cara ngeclear file nya
 Open pathh & aaa For Output As #ff
Close #ff

0 Komentar:

Posting Komentar