By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,299 Members | 1,141 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,299 IT Pros & Developers. It's quick & easy.

Text file in project

P: n/a
d4
I added a Text file to my Project (Add New Item Text File).
I've added a button so when a user clicks on it it will bring up the
text file to read, only problem is I cannot figure out how to call the
Text file to show? I'm sure its easy, but I don't see it. Thanks in
advance.

Sep 18 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
you can either make a form thatl display it to the user, or you can use

System.Diagnostics.Process.Start(''Text File Location Here'')

which will bring up the system's default text editing program with the file
loaded (ex notepad)

hope this helps!

--
-iwdu15

Sep 18 '07 #2

P: n/a
In addition to iwds15's suggestion you could put a RichTextBox on your form
and assign the file text to its .Text member.

Bob

"d4" <d4****@gmail.comwrote in message
news:11*********************@r29g2000hsg.googlegro ups.com...
>I added a Text file to my Project (Add New Item Text File).
I've added a button so when a user clicks on it it will bring up the
text file to read, only problem is I cannot figure out how to call the
Text file to show? I'm sure its easy, but I don't see it. Thanks in
advance.

Sep 19 '07 #3

P: n/a
Here is a sub question for everyone, after reading this I tried
something and I couldn't quite figure it out.
I cant quite seem to google it either as the words im searching for are
too vague for htm and webbrowser.

I added a simple .htm file to my app and added to a form a webbrowser
control. However I cant seem to figure out how to load that htm file in
the browser control.
( trying to open it within my form ) instead of opening up a new process.

Miro

eBob.com wrote:
In addition to iwds15's suggestion you could put a RichTextBox on your form
and assign the file text to its .Text member.

Bob

"d4" <d4****@gmail.comwrote in message
news:11*********************@r29g2000hsg.googlegro ups.com...
>I added a Text file to my Project (Add New Item Text File).
I've added a button so when a user clicks on it it will bring up the
text file to read, only problem is I cannot figure out how to call the
Text file to show? I'm sure its easy, but I don't see it. Thanks in
advance.

Sep 19 '07 #4

P: n/a
just use

Me.WebBrowser1.Navigate("Full Path to HTML File Here")

and thatl browse the IE control to that file

hope this helps!
--
-iwdu15
Sep 19 '07 #5

P: n/a
"d4" wrote:
I added a Text file to my Project (Add New Item Text File).
I've added a button so when a user clicks on it it will bring up the
text file to read, only problem is I cannot figure out how to call the
Text file to show? I'm sure its easy, but I don't see it. Thanks in
advance.

Every file (wav, jpg, txt, ico, etc.) that you add to your project is called
a resource. To access a resource, you can use code like this:

'Textfiles are treated as strings !
Dim myString As String
myString = My.Resources.TextFile_1
TextBox1.Text = myString

If you want know more about resources, please have a look at the
my.resources namespace or search MSDN for something like "Basic concepts of
resources" or "Working with resources".
Sep 19 '07 #6

P: n/a
d4
I should have mentioned that this is a Windows App
The Process.Start has the "The system cannot find the file specified"
exception, and I couldn't find it in My.Resources,
so I just created a RichTextBox on a form and put the text in there.
Not exactly what I wanted, but it'll do.
Thanks.


Sep 19 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.