hi..
Introduction:
Here i can describe how to create an log file(.txt) in vb.net ,By using this log file you can store event information or login time ,lout time any informations you can store into log file
Description:
For an examble if you want store user login information,
First you can store the login information in to an variable and then follow this steps..
Add one new button and write this code....
Private Sub btn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn.Click
source="c:\log" 'Going to create a Directory
If not Directory.Exists(source) Then 'Checking Directory Exist or Not
Directory.CreateDirectory(source)
MsgBox("New Directory Created", MsgBoxStyle.Information)
end if
Dim filelocation as string =source & "file.txt"
Dim fs As New FileStream(filelocation, FileMode.Create, FileAccess.Write)
Dim writer As New StreamWriter(fs)
writer.writeline("mention login time") 'Here mention store variable login time
writer.writeline("mentionlogouttime")
writer.close()
end sub
By using this you can easily create a file and directory in vb.net
i Hope this one Helpful 2 u..............................