Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 136,547 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,845 people online right now. Registration is fast and FREE... Join Now!




Help writing to text file

 
Reply to this topicStart new topic

Help writing to text file, WRITING TO FILES

SNAKE MAN
15 Aug, 2008 - 04:04 AM
Post #1

New D.I.C Head
*

Joined: 15 Aug, 2008
Posts: 5

I have a problen with writing to text files
i just can write numbers to the files and i cant wite anything else and wehen i try to wite text the program writes spaces
this is my code

CODE
Private Sub cmdadd_Click()
    Dim s As String
    s = abc
    Open "D:\output.txt" For Output As #1
    Print #1, s
    Close #1
End Sub

i have tried :
for output
append
random
binary
but it gave me the same result
what i have to do to write text in text files
User is offlineProfile CardPM
+Quote Post

jens
RE: Help Writing To Text File
15 Aug, 2008 - 04:25 AM
Post #2

D.I.C Head
Group Icon

Joined: 9 May, 2008
Posts: 113



Thanked: 3 times
Dream Kudos: 150
My Contributions
Maybe s = abc should be s = "abc"... smile.gif

If that isn't your problem here is a pice of code that works in VB6 (which is the forum you're in):

CODE

fileId = FreeFile
Open searchPath For Output As #fileId
Write #fileId, Form1.Text2.Text
'or you could do it like this
'Write #fileId, "This text will be written to file."
Close #fileId


/Jens

This post has been edited by jens: 15 Aug, 2008 - 04:29 AM
User is offlineProfile CardPM
+Quote Post

SNAKE MAN
RE: Help Writing To Text File
15 Aug, 2008 - 04:30 AM
Post #3

New D.I.C Head
*

Joined: 15 Aug, 2008
Posts: 5

yes u r right
s = "abc" worked
i forgot it
thanx man
User is offlineProfile CardPM
+Quote Post

jens
RE: Help Writing To Text File
15 Aug, 2008 - 04:48 AM
Post #4

D.I.C Head
Group Icon

Joined: 9 May, 2008
Posts: 113



Thanked: 3 times
Dream Kudos: 150
My Contributions
QUOTE

i forgot it
thanx man


We all do... biggrin.gif And... About the thanx... Press the "This Post Was Helpful!" thingy - give my my first thanks, I want it, I need it - now! wink2.gif rolleyes.gif

/Jens

This post has been edited by jens: 15 Aug, 2008 - 04:48 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 10:58PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month