Trouble with opening and reading in text from DHTML app 
Author Message
 Trouble with opening and reading in text from DHTML app

I  am having trouble with the path to the text file I am trying to open and
read in a dhtml app.

I have tried having the path to the file 2 different ways. I just uncomment
one at a time.
1. with the appPath. Problem: when the dhtml app is made, the actual path to
the vb project file is stored in the code, so this does not work when moving
the files to a different machine.
2. trying to use as in html, a relative path. Problem: This works when
running in VB, but does not once I make the dhtml app. Cannot find file.

Am I going at this wrong? All I want is to be able to read in a file into a
textbox. Let the user edit the textbox, and then, in code write out the file
with a different name.

Thanks for any help
Brandon

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''''''''''''''
Private Function Button1_onClick() as Boolean

Dim fs, f

appPath = App.Path

'faqpath = appPath & "\" & "OverView.txt"
'faqpath = "OverView.txt"

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.OpenTextFile(faqpath)

TextArea1.Value = f.readAll

f.close

End Function



Tue, 28 Sep 2004 23:40:51 GMT  
 Trouble with opening and reading in text from DHTML app
when applyiong app.path, chances are the "\" character is already added if
its a root dir, so check for it...
if right(app.path,1)="\" then    dont add a "\" else app.path & "\"


Quote:
> I  am having trouble with the path to the text file I am trying to open
and
> read in a dhtml app.

> I have tried having the path to the file 2 different ways. I just
uncomment
> one at a time.
> 1. with the appPath. Problem: when the dhtml app is made, the actual path
to
> the vb project file is stored in the code, so this does not work when
moving
> the files to a different machine.
> 2. trying to use as in html, a relative path. Problem: This works when
> running in VB, but does not once I make the dhtml app. Cannot find file.

> Am I going at this wrong? All I want is to be able to read in a file into
a
> textbox. Let the user edit the textbox, and then, in code write out the
file
> with a different name.

> Thanks for any help
> Brandon

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

- Show quoted text -

Quote:
> ''''''''''''''''''''''''''''''''''''''''''''''''''
> Private Function Button1_onClick() as Boolean

> Dim fs, f

> appPath = App.Path

> 'faqpath = appPath & "\" & "OverView.txt"
> 'faqpath = "OverView.txt"

> Set fs = CreateObject("Scripting.FileSystemObject")
> Set f = fs.OpenTextFile(faqpath)

> TextArea1.Value = f.readAll

> f.close

> End Function



Wed, 29 Sep 2004 00:05:30 GMT  
 Trouble with opening and reading in text from DHTML app
I did the test, and app.path did not contain "\".

The problem with using the app.path is that this variable is stored when the
dhtml app is created, ie. Make myProject.dll in the File Menu.

I am finding out that, it does not work the same as when running a vb.exe,
and the variable is created at runtime.

So, my thinking is that I wiil not be able to use app.path.

But, I am having no luck with a relative path either, ie.
fs.openTextFile("text.txt")


Quote:
> when applyiong app.path, chances are the "\" character is already added if
> its a root dir, so check for it...
> if right(app.path,1)="\" then    dont add a "\" else app.path & "\"



> > I  am having trouble with the path to the text file I am trying to open
> and
> > read in a dhtml app.

> > I have tried having the path to the file 2 different ways. I just
> uncomment
> > one at a time.
> > 1. with the appPath. Problem: when the dhtml app is made, the actual
path
> to
> > the vb project file is stored in the code, so this does not work when
> moving
> > the files to a different machine.
> > 2. trying to use as in html, a relative path. Problem: This works when
> > running in VB, but does not once I make the dhtml app. Cannot find file.

> > Am I going at this wrong? All I want is to be able to read in a file
into
> a
> > textbox. Let the user edit the textbox, and then, in code write out the
> file
> > with a different name.

> > Thanks for any help
> > Brandon

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

- Show quoted text -

Quote:
> > ''''''''''''''''''''''''''''''''''''''''''''''''''
> > Private Function Button1_onClick() as Boolean

> > Dim fs, f

> > appPath = App.Path

> > 'faqpath = appPath & "\" & "OverView.txt"
> > 'faqpath = "OverView.txt"

> > Set fs = CreateObject("Scripting.FileSystemObject")
> > Set f = fs.OpenTextFile(faqpath)

> > TextArea1.Value = f.readAll

> > f.close

> > End Function



Wed, 29 Sep 2004 00:24:40 GMT  
 Trouble with opening and reading in text from DHTML app
from my own opinion which might not be totally true,
i would got about using the first method...that is the App.Path

but i would not be using app.path as it is too dynamic and unpredictable.
i will try some predictable path such as "c:\" , everyone should have a
"c:\" drive or
i could use retrieve window directory or window\system directory which can
be
obtain through win32 api call.


Quote:
> I  am having trouble with the path to the text file I am trying to open
and
> read in a dhtml app.

> I have tried having the path to the file 2 different ways. I just
uncomment
> one at a time.
> 1. with the appPath. Problem: when the dhtml app is made, the actual path
to
> the vb project file is stored in the code, so this does not work when
moving
> the files to a different machine.
> 2. trying to use as in html, a relative path. Problem: This works when
> running in VB, but does not once I make the dhtml app. Cannot find file.

> Am I going at this wrong? All I want is to be able to read in a file into
a
> textbox. Let the user edit the textbox, and then, in code write out the
file
> with a different name.

> Thanks for any help
> Brandon

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

- Show quoted text -

Quote:
> ''''''''''''''''''''''''''''''''''''''''''''''''''
> Private Function Button1_onClick() as Boolean

> Dim fs, f

> appPath = App.Path

> 'faqpath = appPath & "\" & "OverView.txt"
> 'faqpath = "OverView.txt"

> Set fs = CreateObject("Scripting.FileSystemObject")
> Set f = fs.OpenTextFile(faqpath)

> TextArea1.Value = f.readAll

> f.close

> End Function



Tue, 05 Oct 2004 14:16:34 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Trouble reading-writing to text window

2. DHTML troubles and confusion

3. Trouble Opening a Word Document with VB.NET,Open member not found in Documents

4. Reading text box in other VB app

5. Reading a text file into a VB app

6. Reading text from another App's Window

7. How to read text off another app?

8. Text file never opens for reading (ASP)

9. Read text from console app using vb.net?

10. Open a text file passed from another app

11. Read text in window of another app?

12. HELP;Reading text data from other apps

 

 
Powered by phpBB® Forum Software