|
-
Nov 2nd, 2003, 07:11 AM
#1
Thread Starter
Supreme User
App.Path [RESOLVED!]
Ive got a listbox, so when i click on a certain item, i want to open a text file into my textbox. The text files are in a extra folder called Tutorials. Here is what ive been trying to use to open the file:
VB Code:
Open App.Path & "\Tutorials\Common Dialog.txt" For Binary As #1
Dim scriptText As String: scriptText = Space(LOF(fnum))
Get #1, , scriptText
txtCode.Text = scriptText
Close #fnum
But that doesnt work. I even tried changing For Binary to Input. But it doenst load anything. Any ideas?
THANKS!
Last edited by Madboy; Nov 2nd, 2003 at 01:23 PM.
-
Nov 2nd, 2003, 09:48 AM
#2
Member
i wouldnt use binary for a text file, try this:
VB Code:
dim ffile as Integer
dim strData as String
ffile = FreeFile
Open App.Path & "\Tutorials\Common Dialog.txt" For Input As #ffile
Do until eof(#ffile)
Line Input #ffile, strData
txtCode.Text = txtCode.text & strData & vbcrlf
DoEvents
Loop
Close #ffile
a 17 year old kid who has nothing better to do !
and i never said i was right !!!
-
Nov 2nd, 2003, 12:29 PM
#3
Thread Starter
Supreme User
Thanks, but it attempts to load the file but doesnt. The scrollbars go funny and my app locks up
-
Nov 2nd, 2003, 01:15 PM
#4
Please post your code as you have it now.
-
Nov 2nd, 2003, 01:18 PM
#5
The picture isn't missing
open App.Path & "\Tutorials\Common Dialog.txt" For Input as #1
Dim scriptText As String
scriptText = input$(lof(1),1)
close #1
txtCode.txt=scripttext
-
Nov 2nd, 2003, 01:21 PM
#6
Thread Starter
Supreme User
It doesnt do anything buggy programmer. Have i got the App.Path code right?
And i was using this code marty:
VB Code:
Open App.Path & "\Tutorials\Common Dialog.txt" For Binary As #1
Dim scriptText As String: scriptText = Space(LOF(fnum))
Get #1, , scriptText
txtCode.Text = scriptText
Close #fnum
-
Nov 2nd, 2003, 01:22 PM
#7
Thread Starter
Supreme User
Silly me. I have a seperate folder called My Programs, i put the tutorials in there, instead of in my Projects folder. It works great now.
THANKS!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|