CODE
Form 1
Private Sub Clear_Click()
Content.Text = ""
Content.SetFocus
End Sub
Private Sub Exit_Click()
End
End Sub
Private Sub Readfromfile_Click()
Dim Strg As String, fNum As Integer
On Error GoTo label
fNum = FreeFile()
Open "E:\vbhas\Sample.txt" For Input As #fNum
While Not EOF(fNum)
Line Input #fNum, Strg
Content.Text = Content.Text & Strg
Wend
Close #fNum
Content.SetFocus
Exit Sub
label:
MsgBox "Error............" & vbCrLf & Err.Description
End Sub
33
Private Sub Writetofile_Click()
Dim i As Integer, fNum As Integer
On Error GoTo label
fNum = FreeFile()
Open "E:\vbhas\Sample.txt" For Output As fNum
Print #fNum, Content.Text
Content.SetFocus
Close #fNum
Exit Sub
label:
MsgBox "Error............." & vbCrLf & Err.Description
End Sub
Monday, June 14, 2010
FILE APPLICATION
AIM: To create a file and to perform write and read operations
0 comments:
Post a Comment