Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / June 2008

Tip: Looking for answers? Try searching our database.

Can't derive from System.Windows.Forms.TreeView

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Axel Dahmen - 23 Jun 2008 02:38 GMT
Hi,

I'd like to create a specialized version of System.Windows.Forms.TreeView. But creating a class and deriving from TreeView doesn't work. I can't drag this new class onto a Form or store it in the Toolbox.

What am I doing wrong here? How can I derive from TreeView and have all the Visual Studio Designer features?

TIA,
Axel Dahmen
Jack Jackson - 23 Jun 2008 05:41 GMT
>Hi,
>
[quoted text clipped - 4 lines]
>TIA,
>Axel Dahmen

Create a new UserControl class.  Change the inheritance from
UserControl to TreeView (if using VS2005 or later this is in the
.designer file).  You will have to comment out or remove one line in
the generated code that will give an error once you change the class.
Morten Wennevik [C# MVP] - 23 Jun 2008 06:46 GMT
Hi Axel,

You can create your own TreeView easily, but it may not always pop up in the
ToolBox, especially if you have lot of third party controls already in the
ToolBox.

Make sure Tools->Windows Forms Designer->General->Autopopulate ToolBox is
set to true (remember to restart the solution if you change the setting).  If
you still have problems seeing the control (PS! controls should be in the
toolbox in a group called "<project> components") you may have to add a
regular TreeView and change the class in the designer.cs file.

Its a bit unclear what you mean by "I can't drag this new class onto a Form
or store it in the Toolbox." Can you elaborate?

Signature

Happy Coding!
Morten Wennevik [C# MVP]

> Hi,
>
[quoted text clipped - 7 lines]
> TIA,
> Axel Dahmen
Axel Dahmen - 24 Jun 2008 00:39 GMT
Thanks, Jack and Morten!

Going through your tips I've found the reason why it didn't work yesterday. I forgot to declare my class as "public"....

I found your tips - particularly the "toolbox group called <project> components tip - very valuable.

Thanks a lot! And best regards,
Axel Dahmen

--------------------------------
> Hi Axel,
>
[quoted text clipped - 22 lines]
>> TIA,
>> Axel Dahmen

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.