Hi,

I've created 'Windows Control Library' project in VS2005, created one control in this project which inherits from UserControl class like this:

class MyControl : UserControl
{
MyControl(){_myproperty = 0;}
int _myproperty;

int MyProperty
{
       get { return _myproperty;}
       set { _myproperty = value}
}
}

So, now, the property is not available in the 'Properties' window while in the designer.
While I compile and run, the 'Test container' appears, where I can see how MyControl works. In the 'Test container' MyProperty is available in the 'Properties'. This is something I can understand.

The problem is, when I add compiled control library reference to another project and add an instance of MyControl to some form in this new project. There is NO MyProperty in the 'Properties' for MyControl instance.

Ideas?

Recommended Answers

All 3 Replies

u have to make it public in order to access it.
public int myProperty......

oh... sorry, it is public, I haven't copy-pasted the code - just typed it by hand. It is public and still all above occurs.

Thanks for reply, though

Could you post the real code, because otherwise we're just speculating. It really does look like the property isn't public. If the class is public, and the property is public, then you've got a tricky one on your hands. Let's see the code!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.