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

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




Open For Input on VB 2008

 
Reply to this topicStart new topic

Open For Input on VB 2008, the change in this function from vb6 to 2008

VB-kun
4 Apr, 2008 - 08:45 PM
Post #1

New D.I.C Head
*

Joined: 4 Apr, 2008
Posts: 1

I have been using Visual Basic 6 for a while now and just recently moved to VB 2008. Well its taking some time to get used to but I'm not exactly sure how to open and input or output text files.

in 6 you wrote
CODE
Private Sub Command1_Click()
Dim name as string
Open App.Path & "\TEXTFILE.TXT" For Input As #1
Input #1, name
Close #1
End Sub


just as an example. now I can't figure out app.path or inputs or outputs anymore in Visual Basic 2008.

farthest I got was
CODE
System.Diagnostics.Process.Start
which doesn't seem to even be close to the same thing.

This post has been edited by VB-kun: 4 Apr, 2008 - 08:46 PM
User is offlineProfile CardPM
+Quote Post

Martyr2
RE: Open For Input On VB 2008
5 Apr, 2008 - 10:54 PM
Post #2

Programming Theoretician
Group Icon

Joined: 18 Apr, 2007
Posts: 5,213



Thanked: 217 times
Expert In: C/C++, Java, VB, VB.NET, C#, PHP, Web Development, HTML & CSS, Javascript

My Contributions
In visual studio 2008 they moved all the objects and functions dealing with files into a namespace called "System.IO" this namespace provides objects for things like files, directories and file streams... which you would use to open, write and close files.

One object you will want to lookup is called "StreamReader". This object allows you to open a file and returns a stream. This stream object has methods like read and readLine. As you can imagine if there is a reader there is a writer. The object "StreamWriter" can be used for writing to files. Again it opens up files and creates a stream that you can use to get access to methods like write and writeLine.

Lookup these two objects and look for examples on both the DIC board and on the web and you will see plenty of code to show you how they are used.

If you have any more questions about them, you can ask us and I am sure we will be glad to help.

Enjoy! smile.gif
User is offlineProfile CardPM
+Quote Post

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

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