Click here to Skip to main content
15,868,141 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I'm attempting to create a custom ListView class to resolve flicker and custom draw stuff.

Is it possible to derive a new class from ListView base class? The class wizard seems to object: "The class cannot be derived from a managed class.". This was a no-brainer in C#.

The IDE is VS 2012 Express, C++
Posted
Comments
Sergey Alexandrovich Kryukov 1-Jul-13 9:09am    
In what code do you have this error message? Don't you think that asking a question without showing it is at least strange?
—SA
Mark F. 2-Jul-13 12:16pm    
I don't understand the confusion. The message was copied exactly from the error dialog box. The error was a standard error message generated from the class wizard. I attempted to derived a new custom class with System::Windows::Forms::ListView as the base class. There is also no code for me to post because I never was able to generate a new class.

If I hard code your suggestion I am able to create the class, but not with the class wizard.


Sergey Alexandrovich Kryukov 2-Jul-13 12:29pm    
I don't have any confusion, you do. You should show a code sample related to the message, isn't it obvious? I answered based on some guesswork and think that is it.
And I have no idea what is the "class wizard"; probably something not designed to be used by real developers... :-)
—SA
Mark F. 6-Jul-13 10:44am    
The Class Wizard is the built in wizard form in the VS IDE for creating new classes. It is available from the menus and in the Solution Explorer view. There is no code to post here because the wizard returned that error message and therefore did not create the class code in the editor. I was not confused about anything other than why I could not create the derived class in the first place. This issue has nothing to do with my code, but with the wizard. The error message is to ambiguous for me to resolve the issue.

I thought I was clear on this in my first post: "Is it possible to derive a new class from ListView base class? The class wizard seems to object: "The class cannot be derived from a managed class."."
Sergey Alexandrovich Kryukov 6-Jul-13 13:34pm    
Yes, yes, sure. You were clear, but it asking question it's really useful to provide a relevant code sample, otherwise it's hard to be sure about what's going on. Anyway, the class wizard is nothing but an assistant in writing some regular code.
—SA

1 solution

Pretty bad question — please see my comment to it.

However, before you clarify it: I suspect you are trying to derive non-managed class from this .NET FCL class. You should use a managed "ref" class as a derived class. You probably was confused by the possibility to write "mixed-mode" (managed + unmanaged) code with C++/CLI. Write just managed code, before you learn how to mix.

I hope it will immediately resolve your problem. If not, please don't blame me, pose your question accurately instead.

—SA
 
Share this answer
 
Comments
Espen Harlinn 2-Jul-13 10:42am    
5'ed!
Sergey Alexandrovich Kryukov 2-Jul-13 11:31am    
Thank you, Espen.
—SA
Mohamed Zaki Jun2021 22-Jun-21 7:31am    
the question was simple and clear. I didnt like your way for replying him actually.
I come here to see the answer. but instead I found you fighting him.
Mark F. 22-Jun-21 12:07pm    
First of all, sorry if I offended you/him. Secondly, that question was posted eight years ago and I don't even remember what I was working on at the time. Thirdly, I don't even code in C++ anymore.

Please have a nice day. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900