471,624 Members | 1,794 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,624 software developers and data experts.

inherite windows forms user control

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
Dec 16 '05 #1
2 1742
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/

Dec 16 '05 #2
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

"Bajoo" <Na**********@gmail.com> ????
news:11*********************@g14g2000cwa.googlegro ups.com...
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/

Dec 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Tim Haughton | last post: by
5 posts views Thread by John Smith | last post: by
7 posts views Thread by Tyler Foreman | last post: by
4 posts views Thread by Rod Gill | last post: by
21 posts views Thread by Dan Tallent | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
1 post views Thread by ZEDKYRIE | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.