B bunze Well-known member Joined Aug 4, 2005 Messages 52 Location Adirolf Programming Experience 1-3 Aug 5, 2005 #1 In a form load event I want to load a specified .txt file to a textbox. I don't mean user specified, I want it to be specified by me already in the code.
In a form load event I want to load a specified .txt file to a textbox. I don't mean user specified, I want it to be specified by me already in the code.
M malitice Active member Joined Feb 20, 2005 Messages 41 Programming Experience 1-3 Aug 5, 2005 #2 At the very top of the forms code add: VB.NET: Imports System.IO To use the code just add the following to your program: VB.NET: Dim sr As StreamReader = File.OpenText("file_name_here") textbox1.text = sr.ReadToEnd Upvote 0 Downvote
At the very top of the forms code add: VB.NET: Imports System.IO To use the code just add the following to your program: VB.NET: Dim sr As StreamReader = File.OpenText("file_name_here") textbox1.text = sr.ReadToEnd
JuggaloBrotha VB.NET Forum Moderator Staff member Joined Jun 3, 2004 Messages 4,530 Location Lansing, MI; USA Programming Experience 10+ Aug 6, 2005 #3 dont forget to use sr.close so it clears the buffer and all of it goes to the textbox Upvote 0 Downvote