Turn your Mobile Apps into m-commerce apps – Learn More!

You're Browsing As A Guest! Register Now...
Become a VB.NET Expert!

Join 415,715 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 716 people online right now.Registration is fast and FREE... Join Now!



Page 1 of 1
  • You cannot start a new topic
  • Reply Reply

Visual Basic 2008 - Help with Read from text file and display in text Rate Topic: -----

#1 revolution14  Icon User is offline

  • New D.I.C Head
  • Pip

Reputation: 1
  • View blog
  • Posts: 49
  • Joined: 11-December 07


Dream Kudos: 0

Share |

Visual Basic 2008 - Help with Read from text file and display in text

Posted 26 May 2008 - 02:22 AM

Hello there coders, ihave found alot of information of how to do this for vb6 however i am using vb 2008 and the code for vb6 does not seem to work.

I have designed a form with a text box on it, and a command button underneath. The idea is to run this as a sort of stiky notes section.

I want the text box to read rich text into the textbox (C:\\stickynotes.rtf")

Then i have a command button underneath which i want to save the content of the rich text box to the rtf file (C:\\stickynotes.rtf). This is so that the user can edit and ammend information.


I hope somone can help me with this i am mega confused :blink:

here is some code i have so far


Dim fileReader As System.IO.StreamReader
		fileReader = My.Computer.FileSystem.OpenTextFileReader("C:\\stickynotes.rtf")



This post has been edited by revolution14: 26 May 2008 - 03:05 AM

Was This Post Helpful? 0
  • +
  • -


#2 Jayman  Icon User is offline

  • Student of Life
  • Icon

Reputation: 380
  • View blog
  • Posts: 9,355
  • Joined: 26-December 05


Dream Kudos: 500

Expert In: Everything

Re: Visual Basic 2008 - Help with Read from text file and display in text

Posted 26 May 2008 - 08:18 AM

StreamReader has a ReadToEnd method that will read the file. So all you need to do is load it into a TextBox. Give it a try and see what you come up with. We are always here to help.

StreamReader..::.ReadToEnd Method
Was This Post Helpful? 1

#6 WayneSpangler  Icon User is offline

  • D.I.C Head
  • PipPip

Reputation: 22
  • View blog
  • Posts: 106
  • Joined: 22-March 08


Dream Kudos: 0

Re: Visual Basic 2008 - Help with Read from text file and display in text

Posted 27 May 2008 - 09:03 AM

Why not use a richtextbox instead of a textbox.
You can then read in the text with:
 RichtextBox1.LoadFile(Filename, RichTextBoxStreamType.RichText)

and save:
RichtextBox1.SaveFile(Filename, RichTextBoxStreamType.RichText)

Was This Post Helpful? 2

#7 chosen_12  Icon User is offline

  • New D.I.C Head
  • Pip

Reputation: 1
  • View blog
  • Posts: 29
  • Joined: 11-November 09


Dream Kudos: 0

Re: Visual Basic 2008 - Help with Read from text file and display in text

Posted 11 January 2010 - 03:42 AM

hEllo agAIN.. im hoping that some how someone would suggest a topic for me!? im getting a hard time of it!
by the way if anyone would ask im an I.T student and i am so glad that i can find a site like this that would be helpful for some students like me....
hoping that someone could help me.....
as i am reading your rules i hope that you wouldn't mind giving me such advices because i believe you were the Pro's in this profession....

thanks for letting me be a part of this! =') :D :D java script:emoticon(':D',%20'smid_2')
Was This Post Helpful? 0
  • +
  • -

#8 warework  Icon User is offline

  • New D.I.C Head
  • Pip

Reputation: 0
  • View blog
  • Posts: 17
  • Joined: 08-July 09


Dream Kudos: 0

Re: Visual Basic 2008 - Help with Read from text file and display in text

Posted 06 February 2010 - 03:16 PM

a easy way to open a text file to a richtextbox or a textbox in vb20008 is
dim read as new io.streamreader("file")
textbox1.text=read.readtoend
read.close



or if u want to start a textfile in the default text editor / Reader
system.diagnostic.process.start("file")

god luck
Was This Post Helpful? 0
  • +
  • -

#9 Guest_codefreak*


Reputation:

Re: Visual Basic 2008 - Help with Read from text file and display in text

Posted 27 June 2010 - 09:36 AM

dudes..............
the code was gud but you also can have the easiest way






Dim fstream As New IO.StreamReader(abc)
MsgBox(My.Computer.FileSystem.ReadAllText(abc))


where abc is a string for a rootpath
you can construct the root path by =================>IO.Path.Combine("f:\", q)
where q is a string which is a file name to be appeneded

u can open a text file in the directory by this mthd

cooooooooooool.......

contact me ========>
Was This Post Helpful? 0

Page 1 of 1
  • You cannot start a new topic
  • Reply Reply


Fast Reply

  

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users