please give me the code to create a text file in vb
create text fileplease give me the code to create a text file in vb
Page 1 of 1
2 Replies - 4431 Views - Last Post: 05 November 2009 - 02:53 AM
Replies To: create text file
#2
Re: create text file
Posted 05 November 2009 - 12:21 AM
Here you are:
This example illustrates various uses of the Open statement to enable input and output to a file.
The following code opens the file TESTFILE in sequential-input mode.
Change the TESTFILE with you text file path and name : example: "c:\something.txt"
Open "TESTFILE" For Input As #1
' Close before reopening in another mode.
Close #1
This example opens the file in Binary mode for writing operations only.
Open "TESTFILE" For Binary Access Write As #1
' Close before reopening in another mode.
Close #1
The following example opens the file in Random mode. The file contains records of the user-defined type Record.
Type Record ' Define user-defined type.
ID As Integer
Name As String * 20
End Type
Dim MyRecord As Record ' Declare variable.
Open "TESTFILE" For Random As #1 Len = Len(MyRecord)
' Close before reopening in another mode.
Close #1
This code example opens the file for sequential output; any process can read or write to file.
Open "TESTFILE" For Output Shared As #1
' Close before reopening in another mode.
Close #1
This code example opens the file in Binary mode for reading; other processes cannot read file.
Open "TESTFILE" For Binary Access Read Lock Read As #1
This example illustrates various uses of the Open statement to enable input and output to a file.
The following code opens the file TESTFILE in sequential-input mode.
Change the TESTFILE with you text file path and name : example: "c:\something.txt"
Open "TESTFILE" For Input As #1
' Close before reopening in another mode.
Close #1
This example opens the file in Binary mode for writing operations only.
Open "TESTFILE" For Binary Access Write As #1
' Close before reopening in another mode.
Close #1
The following example opens the file in Random mode. The file contains records of the user-defined type Record.
Type Record ' Define user-defined type.
ID As Integer
Name As String * 20
End Type
Dim MyRecord As Record ' Declare variable.
Open "TESTFILE" For Random As #1 Len = Len(MyRecord)
' Close before reopening in another mode.
Close #1
This code example opens the file for sequential output; any process can read or write to file.
Open "TESTFILE" For Output Shared As #1
' Close before reopening in another mode.
Close #1
This code example opens the file in Binary mode for reading; other processes cannot read file.
Open "TESTFILE" For Binary Access Read Lock Read As #1
#3
Re: create text file
Posted 05 November 2009 - 02:53 AM
we usual don`t give like this codes but we have nice tutorial & snipped section you can take a look at
Page 1 of 1
|
|

New Topic/Question
Reply




MultiQuote




|