create text file

please give me the code to create a text file in vb

Page 1 of 1

2 Replies - 5174 Views - Last Post: 05 November 2009 - 02:53 AM Rate Topic: -----

#1 resmy ravi  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 04-November 09

create text file

Posted 04 November 2009 - 11:43 PM

please give me the code to create a text file in vb
Is This A Good Question/Topic? 0
  • +

Replies To: create text file

#2 bytelogik  Icon User is offline

  • D.I.C Head

Reputation: 22
  • View blog
  • Posts: 212
  • Joined: 06-October 09

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
Was This Post Helpful? 0
  • +
  • -

#3 raziel_  Icon User is offline

  • Like a lollipop
  • member icon

Reputation: 465
  • View blog
  • Posts: 4,255
  • Joined: 25-March 09

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 :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1