inherite windows forms user control

R

Ryan Liu

Hi,

Can someone give me a hlep on inherited user control?

I try to inherite windows forms user control, like ListView.

From Visual studio 2003, I right click a folder and selct "Add inherited
user control ...", then I browser to

c:\winnt\microsoft.net\framework\v1.1.4322\system.windows.forms.dll

But I don't see windows forms control(e.g. ListView) in the list.


Then I just create a class MyListView and inherite ListView, and try to put
it on a form, then Press F4 to edit its properties, it gives me an
System.StackOveeflowException. What cause this to happen?

What is right way to develop a inherited user control, like my own ListView?

Thanks a lot!
Ryan
 
B

Bajoo

Dear ryan ,
Following is the way to Inhert a control

public class MyForm: Form
{
.....// ur implementation
}

public class MyListView : ListView
{
...//// ur code
}

Regards,
Naveed Ahmad Bajwa
http://bajoo.blogspot.com/
 
R

Ryan Liu

Thanks Najoo!

And I also find the System.StackOveeflowException is because of my silly
mistake:

The public property name is same as private attribute name, so it trigger an
endless loop.

And see MyListView as a control on toolboxes, I just added a class, then
later I change
MyListView: UserControl to MyListView:ListView.

This trick works fine for me.

All the Best,
Ryan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top