[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 412
  • Last Modified:

Using VB.NET Treeview control in VB6

Hi,

I need to use the VB.NET Treeview control in a VB6 application because the VB.NET Treeview control seems to be much faster the the VB6 one with a large amount of data.  My question is how to do it.

I read some articles about interop between .Net and VB6 and tried to subclass from System.Windows.Forms.TreeView in .Net and build either a COM class or User Control, and add the tlb file into VB6 Project References, and use a New to create a VB.Net treeview in VB6.  It didn't work when I call the New.  Is this approach ever going to work?  I don't know if you can add a control on a VB form by calling New.  I can't find a way to add the VB.Net tlb into Vb6 Project Componets.  Is this even possible??

If someone has done it before or know how, please share your thoughts.

Thanks a lot!
0
jayleno
Asked:
jayleno
  • 2
  • 2
1 Solution
 
SRigneyCommented:
It is possible for you to write your own controls in .Net and have them available for VB6 if you use the correct Attributes with the functions to enable COM functionality, however the .Net controls are not written to be used in VB6.  If the .Net control is faster for your situation, why don't you write the project in VB.Net and have it access any previous VB6 files that are needed?  This is the method that is supported by Microsoft.
0
 
jaylenoAuthor Commented:
SRigney,

Can you elaberate on "use the correct Attributes with the functions to enable COM functionality"?  I cannot port the project to VB.NET because of the project size and time constraints.  So if you can be more specific on the steps to do it I would appreciate it.
0
 
SRigneyCommented:
Here is a link to MSDN where it talks about how to do it.  I haven't done anything like this myself.  I have opted to convert my applications to .Net as often as possible.  

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconexposingnetframeworkcomponentstocom.asp
0
 
jaylenoAuthor Commented:
Hi,

Since I did not find any acceptable answer here, I would like to close and delete this question.  I suppose the best thing to do when encountered with a problem like mine is to stick with VB6 (or VB.NET) and look for other facters to solve the problem.

THanks anyway.
0
 
Computer101Commented:
PAQed, with points refunded (250)

Computer101
E-E Admin
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now