can't access class property 
Author Message
 can't access class property

I have a class stockInfoPanels.cs:

public class stockInfoPanels
{
    private int noOfForms = 0;
    public int noForms
    {
        get {return noOfForms;}
        set {noOfForms = value;}
    }

    public stockInfoPanels()
    {
        //
        // TODO: Add constructor logic here
        //
    }

Quote:
}

I'm trying to access the public property from another form in the same
project. When I type stockInfoPanels. into my other form I don't get my
property in the intellisense list. All it shows is 'equals' and 'reference
equals' come up and not my property.

I'm sure its something silly but what am I doing wrong?

Thanks,

Morkai



Wed, 05 Jan 2005 06:51:34 GMT  
 can't access class property

Quote:
> project. When I type stockInfoPanels. into my other form I don't get my

Have you created a stockInfoPanels object? If you just write:

stockInfoPanels.

to get the intellisens, it will only show the static functions etc, which
can be called without creating an instance of the object. If you do like
this:

stockInfoPanels s = new stockInfoPanels();

s.

you should see the property.



Wed, 05 Jan 2005 07:09:13 GMT  
 can't access class property
Is stockInfoPanels in a namespace and if so are you using the full class
name 'Namespace.stockInfoPanels' or are you using

#using Namespace;

Joel


Quote:
> I have a class stockInfoPanels.cs:

> public class stockInfoPanels
> {
>     private int noOfForms = 0;
>     public int noForms
>     {
>         get {return noOfForms;}
>         set {noOfForms = value;}
>     }

>     public stockInfoPanels()
>     {
>         //
>         // TODO: Add constructor logic here
>         //
>     }
> }

> I'm trying to access the public property from another form in the same
> project. When I type stockInfoPanels. into my other form I don't get my
> property in the intellisense list. All it shows is 'equals' and 'reference
> equals' come up and not my property.

> I'm sure its something silly but what am I doing wrong?

> Thanks,

> Morkai



Wed, 05 Jan 2005 07:09:29 GMT  
 can't access class property
*sound of head hitting desk*

I knew it was something stupid. I've taken it one step further now, I am
using the class to keep track of how many copies of a form I have open so I
can name a statusbar panel accordingly. Setting it as a static method was
the trick and its working. now.

Thanks very much

Morkai


Quote:


> > project. When I type stockInfoPanels. into my other form I don't get my

> Have you created a stockInfoPanels object? If you just write:

> stockInfoPanels.

> to get the intellisens, it will only show the static functions etc, which
> can be called without creating an instance of the object. If you do like
> this:

> stockInfoPanels s = new stockInfoPanels();

> s.

> you should see the property.



Wed, 05 Jan 2005 07:30:44 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Accessing Base Class's control's events

2. Accessing property from another class

3. VC++ Class properties/method access in VB program?

4. Access control's property with a string?

5. Accessing Word 97's ambient properties

6. How do I access an MDB's Custom Properties

7. Can't access properties of an object pased by reference in VC++ 6

8. EVC4: Can't access properties/methods on ActiveX control in web page

9. access class's member in callback

10. can't access class from child window

11. Accessing main window's Status Bar from view class

12. Help accessing a class's variables

 

 
Powered by phpBB® Forum Software