Problem getting Application class properties 
Author Message
 Problem getting Application class properties

I can get some properties of the Application class, but not others.
Specifically, I can't get the following properties of the Application class
in VB.NET:

    CommonAppDataPath
    LocalUserAppDataPath
    UserAppDataPath
    CompanyName
    ProductName
    ProductVersion

When I try I get the following exception:

    Object reference not set to an instance of an object

Yet the documentation says you can't instantiate this class - its static.
And the documentation on the Application class doesn't cover this (or any)
error.

My AssemblyInfo.vb defines the necessary variables.

I'm running Windows XP home.

I figure it must be something simple I'm doing wrong, but I just can't
figure out what it could be.

Any ideas?

Don



Wed, 01 Jun 2005 09:13:02 GMT  
 Problem getting Application class properties
Don,

Quote:
>Any ideas?

Make sure the casing of your Sub Main method is "Main", and not "main"
or "MAIN" or something else. Due to a bug in the Application class, it
has to be "Main".

Mattias

===

http://www.msjogren.net/dotnet/
Please reply only to the newsgroup.



Wed, 01 Jun 2005 22:41:46 GMT  
 Problem getting Application class properties
That was it!  I had used "main". I didn't believe the fix until I tried it.
Now I get all those properties without a problem.

Many thanks Mattias!

Don


Quote:
> Don,

> >Any ideas?

> Make sure the casing of your Sub Main method is "Main", and not "main"
> or "MAIN" or something else. Due to a bug in the Application class, it
> has to be "Main".

> Mattias

> ===

> http://www.msjogren.net/dotnet/
> Please reply only to the newsgroup.



Fri, 03 Jun 2005 05:15:19 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Getting the properties of VB class at runtime

2. VB2008: Getting the System.Reflection.PropertyInfo from within a class property

3. Not getting Events from classes within classes.

4. problem passing Class Properties

5. Problem with Classes/ Property procedures

6. vbs Class: Property Let Problem

7. Problem with a property in a class

8. Exposing Properties collection in custom classes as many MS Classes do

9. Exposing a Properties collection in custom classes as many MS Classes do

10. Problems while getting properties of Document.Range - Object

11. Properties Property for a Custom Class

12. Performance: Compiled Classes as DLL vs Classes in Application Code

 

 
Powered by phpBB® Forum Software