VB School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become a VB Expert!

Join 307,098 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 2,041 people online right now. Registration is fast and FREE... Join Now!




create text file

 

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

resmy ravi

4 Nov, 2009 - 10:43 PM
Post #1

New D.I.C Head
*

Joined: 4 Nov, 2009
Posts: 1

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

User is offlineProfile CardPM
+Quote Post


bytelogik

RE: Create Text File

4 Nov, 2009 - 11:21 PM
Post #2

D.I.C Head
**

Joined: 6 Oct, 2009
Posts: 63



Thanked: 5 times
My Contributions
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

User is offlineProfile CardPM
+Quote Post

NoBrain

RE: Create Text File

5 Nov, 2009 - 01:53 AM
Post #3

D.I.C Lover
Group Icon

Joined: 25 Mar, 2009
Posts: 1,214



Thanked: 39 times
Dream Kudos: 125
My Contributions
we usual don`t give like this codes but we have nice tutorial & snipped section you can take a look at smile.gif
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 11/21/09 12:05PM

Live VB Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month