I'm in the process of finishing a program for an assignment in class. I'm
writing settings to a file then saving it in the application's root
directory. The problem is that when I go to use App.Path, VB6 is not
recognizing the App object.
Does anyone know what is happening, or maybe some reference files I should
have checked?
Thanks,
WillSid
Douglas Marquardt - 29 Nov 2004 14:01 GMT
Hi:
Can you be more specific -- post the line of code that causes the
error and describe what the error message is, whether or not
this happens in the ide, compiled or both, etc.
Doug.
> I'm in the process of finishing a program for an assignment in class. I'm
> writing settings to a file then saving it in the application's root
[quoted text clipped - 4 lines]
> Thanks,
> WillSid
Norm Cook - 29 Nov 2004 14:13 GMT
What do you mean by 'not recognizing'. If you type app followed by a
period, do
you get intellisense?
App comes from VB6.OLB which appears in the References dialog as
Visual Basic objects and procedures, and should be checked.
When you first start VB, App.Path will be the directory from which VB was
started,
i. e. App.Path has no real meaning until you save your Project.
> I'm in the process of finishing a program for an assignment in class. I'm
> writing settings to a file then saving it in the application's root
[quoted text clipped - 4 lines]
> Thanks,
> WillSid
Ralph - 29 Nov 2004 14:15 GMT
> I'm in the process of finishing a program for an assignment in class. I'm
> writing settings to a file then saving it in the application's root
[quoted text clipped - 4 lines]
> Thanks,
> WillSid
The App object is intrinsic to every VB application. You might check your
references to make sure you have a reference to VBA and VB runtime, but I
doubt if that is your problem - if they are missing - nothing will work.
Have you perhaps declared your own "App" object/variable elsewhere in the
application?
Rt-Click "App" and select "Definition" from the popup menu.
Are you sure that "App" is not 'recognized' or is it that Intellisense is
not working? Explain further by what you mean by "not recognizing".
-ralph
WillSid - 29 Nov 2004 14:25 GMT
:Well, I'm using a filelistbox and I give the object the following:
File1.Path = app.Path
But when I run the program, it highlights "app" saying:
"Compile Error:
Invalid qualifier"
Hopfully, this might help a little bit better
Larry Serflaten - 29 Nov 2004 14:37 GMT
> :Well, I'm using a filelistbox and I give the object the following:
> File1.Path = app.Path
[quoted text clipped - 5 lines]
>
> Hopfully, this might help a little bit better
Try this; Highlight the word app in that line and press Shift+F2.
If you get taken to some other part of your code, then you have
redifined App in your program. If you create your own App variable,
then VB will try to use that, instead of the default object provided.
You should normally be taken to the Object Browser, if everything is
set up right.
What happens in your case?
To circumvent VB using your own declared variable, you can
use a fully qualified name to tell VB which App object to use:
File1.Path = VB.App.Path
LFS
Norm Cook - 29 Nov 2004 14:41 GMT
As Ralph said, it appears you have defined 'app' somewhere in your code
which, if true,
overrides VB's App object.
I tried this
Dim app As String
Debug.Print app.Path
which gives the 'Invalid Qualifier' error message.
> :Well, I'm using a filelistbox and I give the object the following:
> File1.Path = app.Path
[quoted text clipped - 5 lines]
>
> Hopfully, this might help a little bit better
WillSid - 29 Nov 2004 14:55 GMT
Thanks Norm and Ralph,
Now that I feel like a complete idiot for doing such a thing, I should be
able to finish my project.
> As Ralph said, it appears you have defined 'app' somewhere in your code
> which, if true,
[quoted text clipped - 14 lines]
> >
> > Hopfully, this might help a little bit better
Ralph - 29 Nov 2004 15:23 GMT
> Thanks Norm and Ralph,
>
[quoted text clipped - 19 lines]
> > >
> > > Hopfully, this might help a little bit better
LOL,
Don't feel bad. I once defined "mID" as a class member. I wasted a good hour
of my life, that I will never see again, trying to figure out why a complex
statement using the Mid() function wouldn't work. <g>
-ralph
Rick Rothstein - 29 Nov 2004 18:14 GMT
> LOL,
>
> Don't feel bad. I once defined "mID" as a class member. I wasted a good hour
> of my life, that I will never see again, trying to figure out why a complex
> statement using the Mid() function wouldn't work. <g>
Now THAT is funny.
Rick
AustinMN - 30 Nov 2004 03:31 GMT
> Don't feel bad. I once defined "mID" as a class member. I wasted a good
> hour
> of my life, that I will never see again, trying to figure out why a
> complex
> statement using the Mid() function wouldn't work. <g>
Only an hour? Although no specifics come to mind, I'm sure I've spent days
on things like this...
Austin (it's only sad if you do it again...which I have)

Signature
You programmed with 1s and 0s? We only had 0s!
There are no X characters in my address