Loading Textfile Into Textbox
Loading Textfile Into Textbox
Loading Textfile Into Textbox
Loading Textfile Into Textbox
Loading Textfile Into Textbox
Loading Textfile Into Textbox Loading Textfile Into Textbox Loading Textfile Into Textbox Loading Textfile Into Textbox Loading Textfile Into Textbox Loading Textfile Into Textbox Loading Textfile Into Textbox Loading Textfile Into Textbox
Loading Textfile Into Textbox Loading Textfile Into Textbox
Loading Textfile Into Textbox
Go Back  Xtreme Visual Basic Talk > > > Loading Textfile Into Textbox


Reply
 
Thread Tools Display Modes
  #1  
Old 01-25-2004, 06:45 AM
Ian96 Ian96 is offline
Junior Contributor
 
Join Date: May 2002
Posts: 353
Default Loading Textfile Into Textbox


This is my saving method

I now need the loading,

Dim myform As New frminvoice1
Dim file As New System.IO.StreamWriter("c:\Details.txt")
file.WriteLine(cbodesc.Text)
file.Close()

Thanks
Reply With Quote
  #2  
Old 01-25-2004, 07:13 AM
reboot's Avatar
rebootLoading Textfile Into Textbox reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,614
Default

A line at a time
Code:
Dim sr As StreamReader Dim sin As String 'open the textfile sr = File.OpenText("c:\Details.txt") 'read the first line sin = sr.ReadLine() 'loop through the file While Not sin Is Nothing 'do something with the input string 'read another line sin = sr.ReadLine() End While 'close the reader sr.Close()
All at once
Code:
Dim sr As StreamReader Dim alltext As String 'open the textfile sr = File.OpenText("c:\Details.txt") 'read the whole file alltext = sr.ReadToEnd() 'close the reader sr.Close()
Reply With Quote
  #3  
Old 01-25-2004, 09:54 AM
Ian96 Ian96 is offline
Junior Contributor
 
Join Date: May 2002
Posts: 353
Default

Ive sorted out that now but it is now saying that file is not declared either
Reply With Quote
  #4  
Old 01-25-2004, 10:26 AM
reboot's Avatar
rebootLoading Textfile Into Textbox reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,614
Default

System.IO.File
Reply With Quote
  #5  
Old 01-25-2004, 11:29 AM
Ian96 Ian96 is offline
Junior Contributor
 
Join Date: May 2002
Posts: 353
Default

It does not work nothing happens. I have saved multiple files

file.WriteLine(cbodesc.Text)
file.WriteLine(cbodesc1.Text)
file.WriteLine(cbodesc2.Text) etcc....
Reply With Quote
  #6  
Old 01-25-2004, 11:41 AM
reboot's Avatar
rebootLoading Textfile Into Textbox reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,614
Default

Maybe you should post your code since your constant repeating of "It doesn't work" tells us absolutely nothing useful. The code I gave you works just fine assuming you modify it to fit what you're doing.
Reply With Quote
  #7  
Old 01-26-2004, 05:13 AM
Ian96 Ian96 is offline
Junior Contributor
 
Join Date: May 2002
Posts: 353
Default

Ok this is the way i am saving my data into a textfile from textboxes

Dim myform As New frminvoice1
Dim file As New System.IO.StreamWriter("c:\Invoice1.txt")
file.WriteLine(cbodesc.Text)
file.WriteLine(TxtUPrice.Text)
file.WriteLine(txtQty.Text)
file.WriteLine(txtline.Text)
file.WriteLine(cbodesc1.Text)
file.WriteLine(txtuprice1.Text)
file.WriteLine(txtQty1.Text)
file.WriteLine(txtline1.Text)
file.Close()

This code works for saving and now i simply want to load the information back into the right textboxes.

You have given me this loading code,

Dim sr As system.io.StreamReader
Dim alltext As String

'open the textfile
sr = system.io.File.OpenText("c:\Invoice1.txt")

'read the whole file
alltext = sr.ReadToEnd()

'close the reader
sr.Close()


This loading code does not work
Reply With Quote
  #8  
Old 01-26-2004, 08:13 AM
Machaira's Avatar
MachairaLoading Textfile Into Textbox Machaira is offline
Jedi Coder

* Expert *
 
Join Date: Aug 2002
Location: Abingdon, MD
Posts: 3,438
Default

What do you mean it doesn't work?
Reply With Quote
  #9  
Old 01-26-2004, 08:20 AM
reboot's Avatar
rebootLoading Textfile Into Textbox reboot is offline
Keeper of foo

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Graceland
Posts: 15,614
Default

If you mean it doesn't load the text back into the textboxes, of course it doesn't.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Loading data from a textfile miaoy2 General 1 09-30-2003 01:53 PM
Saving listbox and textbox data of a form into a textfile k80sg File I/O and Registry 1 09-23-2003 11:03 AM
Loading picture from a folder that matches with my textbox Justmean31 Interface and Graphics 12 09-11-2003 06:49 AM
loading textfile into textbox msymeou General 5 05-10-2002 03:10 AM
TextFile to TextBox Mota331 General 6 06-27-2001 10:18 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
Loading Textfile Into Textbox
Loading Textfile Into Textbox
Loading Textfile Into Textbox Loading Textfile Into Textbox
Loading Textfile Into Textbox
Loading Textfile Into Textbox
Loading Textfile Into Textbox Loading Textfile Into Textbox Loading Textfile Into Textbox Loading Textfile Into Textbox Loading Textfile Into Textbox Loading Textfile Into Textbox Loading Textfile Into Textbox
Loading Textfile Into Textbox
Loading Textfile Into Textbox
 
Loading Textfile Into Textbox
Loading Textfile Into Textbox
 
-->