Question Open a text file with double click

Reyn

Member
Joined
Dec 11, 2008
Messages
14
Programming Experience
1-3
This thread contains information on how to do this. However, I was wondering if the origrinal, or anyone else for that matter, could explain what the openFile is in his code. I am guessing it has to do with the System.IO namespace, but I am unsure of what he did, and I am trying to get my application to open text files on an open command.

If anyone could provide another way that was better i would appreciate that too.
 
VB.NET:
Me.TextBox1.Text = My.Computer.FileSystem.ReadAllText(filepath)
filepath variable here contains the file path string.
 
Thanks. I'll have to give this a try. However, i do have a question. How do i get the filepath put into the variable? the program wont be active yet, until the file is opened. how do i take that files path and put it into the variable?
 
Actually, you don't need to use a variable at all, I just used a variable to show you how to call the ReadAllText method. The point is, the ReadAllText method takes a parameter of type string that should contain a file path. Since one or more of the strings in the array of command line arguments is the file path, you just pass those as parameters.
 
Back
Top