Jump to content
  • Advertisement
Sign in to follow this  
Cybrosys

[.net] .Net 2005 Inheriting ListView problems

This topic is 4419 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Okay, i don't know what's wrong but i destinctly remembered being able to create a custom control that inherited for example ListView. When i try to pick one of the inherited options in add a new item all i get is to inherit it from a dll or a form that's already in the project. How can i create a class that inherits the ListView without having to create the class manually since that's only a work-around. :/ [Edited by - Cybrosys on May 19, 2006 4:51:10 PM]

Share this post


Link to post
Share on other sites
Advertisement
Ok.. I am not sure I am reading this right so can you clarify. Are you trying to instanciate a custom Listview control that you want to manually set the properties of or are you trying to create a Custom Control Listview Class that is inherited from ListView?

theTroll

Share this post


Link to post
Share on other sites
If you want to add functionality then you have to make your own class that inherits from ListView.


class CustomListView : ListView
{
public void myCustomFunction()
{
//...
}

}




That should do it for you.

theTroll

Share this post


Link to post
Share on other sites
When i inherit, the class stops being a User control and becomes a Component and i lose the ability to add it to a form from the toolbox.

Share this post


Link to post
Share on other sites
This will show you how to do it.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnppcgen/html/sp_lab1_build_custom_control.asp

theTroll

Share this post


Link to post
Share on other sites
Quote:
Original post by Cybrosys
When i inherit, the class stops being a User control and becomes a Component and i lose the ability to add it to a form from the toolbox.

But you *can* add Components to a form. For example, the Tooltip class inherits from Component.

That being said, I've always thought the tool box was a bit erratic in what it picked up from your own controls and offered for use. For example, if the project containing your custom control/form is under a solution folder, it won't show up in the tool box at all.

What I usually do when inheriting standard controls is just start out with a UserControl, then changing it in the code to inherit from the control I want.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!