open file?

J

james

Sounds like you have no experience with Visual Basic or VB.NET. Here is a link that will give you some pointers on how to work
with files.
http://www.startvbdotnet.com/files/default.aspx


In the Additional Information thing you quoted below,,,,,,,,,,,, it simply means you COPIED Crouchie1998's code sample that
contained the words" Your file & Path Here". What he meant was you needed to include IN YOUR CODE,,,,,,,,,,, the path
YOU want to use and the NAME of YOUR FILE...................not the text" Your File & Path Here". It means you have to do some
work and fill in the blanks yourself.

You need to get a good book on programming for Visual Basic.NET. Time to go to your local bookstore and buy one and start
studying.
james
 
G

Guest

Open for read:

Dim sr As New IO.StreamReader("Your File & Path Here")
Dim strLine As String
strLine = sr.ReadLine() ' or you can use: strLine = sr.ReadToEnd()
sr.Close()

Open for write:

Dim sw As New IO.StreamWriter("Your File & Path Here")
sw.WriteLine("This is a line of text")
sw.Flush()
sw.Close

I hope this helps
 
B

Bernie Yaeger

Hi,

If you mean 'open' in its appropriate environment (eg, a Word doc opening in
Word, an image opening in Photoshop, etc), then use this code (where this
example uses l.text as the text in a listview selection, but of course it
could be a string or the text property or selecteditem property of another
control):

Dim psi As New ProcessStartInfo
psi.UseShellExecute = True

psi.FileName = l.Text

Process.Start(psi)

HTH,

Bernie Yaeger
 
G

Guest

i put that in but it gave me this error:
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in
mscorlib.dll

Additional information: Could not find file "C:\Documents and
Settings\User\Desktop\Your File & Path Here".
 
G

Guest

Kinda, i want to have my program save the information thats in the text boxes
and, labels, etc, kinda like save a snapshot of how it is then, so when i
reopen it in my program, i can continue to edit it
 
G

Guest

any idea how to have my program save the information thats in the text boxes
and, labels, etc, kinda like save a snapshot of how it is then, so when i
reopen it in my program, i can continue to edit it
 

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