![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programmer
Join Date: Sep 2005
Posts: 58
Rep Power: 4
![]() |
Using Text Files...
Ok, I've made a textbox sort of like a text editor (ie: notepad), but I would like it to read the text in the textbox from a .txt file .. I think thats how you say it.. :eek:
The reason for this is because its going to be a fairly long paragraph. Here's a quick little diagram to help clear things up ![]() <3 mspaint I'm sure this is really easy, maybe I'm using the wrong words on Google. EDIT: I've found this: Dim Myfile As String 'Replace "c:\testfile.txt file = "c:\testfile.txt" Open Myfile For Input As #1 Text1.Text = Input(LOF(1), #1) Close When i run it i get an error, i click Debug and the line Open Myfile For Input As #1 is highlighted. Any ideas? Thanks in advance ![]() Last edited by ViOLATiON; Oct 26th, 2005 at 11:22 PM. |
|
|
|
|
|
#2 |
|
Man Bear Pig Hunter
Join Date: Jul 2005
Location: NorCal, USA
Posts: 295
Rep Power: 4
![]() |
What version of Visual Basic?
In VB.NET I believe: FileStream file = new FileStream("C:\textfile.txt",FileMode.OpenOrCreate, FileAccess.Read) StreamReader sr = new StreamReader(file) Text1.Text = sr.ToString() |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Sep 2005
Posts: 58
Rep Power: 4
![]() |
New idea, is to make it read HTML files. I downloaded the MozillaControl 1.0 Type Library, and the code I have right now is:
MozillaBrowser1.Navigate ("file.html") Where file.html is in the same dir as the exe, but it won't find it unless I put the direct path in the source code (ie: c:\app\file.html), and that sucks because everyone wont have it in the same place. Anyway around this? I've tried ("\file.html"), same thing. Thanks guys. |
|
|
|
|
|
#4 | |
|
Programmer
Join Date: Sep 2005
Posts: 58
Rep Power: 4
![]() |
Quote:
I'm running VB 6 |
|
|
|
|
|
|
#5 |
|
Man Bear Pig Hunter
Join Date: Jul 2005
Location: NorCal, USA
Posts: 295
Rep Power: 4
![]() |
Sorry, I got a direct link from the home page....lets see really quick here....
|
|
|
|
|
|
#6 |
|
Man Bear Pig Hunter
Join Date: Jul 2005
Location: NorCal, USA
Posts: 295
Rep Power: 4
![]() |
Use the source from a really old project I have. I don't have VB6 anymore or I'd post it for you and I can't remember it correctly, so here is my program's source.
|
|
|
|
|
|
#7 | |
|
Professional Programmer
Join Date: Sep 2005
Location: serbia & montenegro
Posts: 484
Rep Power: 4
![]() |
Quote:
file = "c:\testfile.txt" Myfile = "c:\testfile.txt" |
|
|
|
|
|
|
#8 |
|
Expert Programmer
|
Good to see a well posted question.
__________________
Join us at #programmingforums @ irc.freenode.net! My software never has bugs. It just develops random features.
|
|
|
|
|
|
#9 |
|
Expert Programmer
|
Indeed. Nevertheless Option Explicit would have avoided this problem.
|
|
|
|
|
|
#10 |
|
Programmer
Join Date: Sep 2005
Posts: 58
Rep Power: 4
![]() |
Thank you ivan, you proved the title below your name
![]() @coldDeath, i figure if I want an answer I should atleast post it so people will understand. I think my sweet diagram helped :p |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|