PowerBasic Vb conversion

J

John

I am old Power Basic programmer. (In DOS)

to open file and write to it looked like this:

Open "filename" as #1 for output as (then you select the type of file
you want)

then to output to that file you use print... like

Print #1, whatever

When your done you use close #1


What is the vb equivalent? How do you open a file, tell what kind it is
then write to it and close it?

I've looked in the help files under open, close, & save and haven't
found it.

Thanks

John
 
S

Steve Rindsberg

to open file and write to it looked like this:
Open "filename" as #1 for output as (then you select the type of file
you want)

then to output to that file you use print... like

Print #1, whatever

When your done you use close #1

What is the vb equivalent? How do you open a file, tell what kind it is
then write to it and close it?

Try doing exactly that in VB or VBA.

Dim sFileName as String
Dim iFileNum as Integer

iFileNum = Freefile() ' rather than specifying 1

Open sFilename for Output as iFilenum ' there are other options in Help
Print #ifilenum, "Now is the time to pretend we can still use PowerBasic"
Close iFilenum
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top