Jul 10th, 2007, 02:00 PM
#1
Thread Starter
Frenzied Member
C# and VB6
Can I use C# to create COM related component so that VB6 or VBA can reference it? If so, please direct me how to create a simple C# COM or assembly that my VB6 projects can use.
Thank You
Last edited by Liquid Metal; Jul 11th, 2007 at 03:34 AM .
I'll Be Back!
T-1000
Microsoft .Net 2005
Microsoft Visual Basic 6
Prefer using API
Jul 10th, 2007, 05:10 PM
#2
Re: C# and VB6
There is a utility tool on the MS site that lets you use VB 6 stuff in a .NET project or it could be the reverse or both ways. Try a search on the MS site for it.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Jul 10th, 2007, 07:48 PM
#3
Jul 10th, 2007, 09:01 PM
#4
Re: C# and VB6
This is possible. After all C# or .NET for that matter was created for inter-language communication. Not primarily but it is a good factor
And rob i think it is the reverse way VB forms don't implement COM i think .
Jul 10th, 2007, 09:06 PM
#5
Re: C# and VB6
I think it serves two purposes:
- one is to minimize the noise (from competitors os course)
- and second to give some backward compatibility to com based languages such as VC++ 6 and VB6.
Jul 11th, 2007, 12:31 AM
#6
Re: C# and VB6
Originally Posted by
Hell-Lord
This is possible. After all C# or .NET for that matter was created for inter-language communication. Not primarily but it is a good factor
And rob i think it is the reverse way
VB forms don't implement COM i
think .
You can create a .NET dll and expose it via COM so it can be used in VB 6. Also, .NET controls can be used with that utility for use in VB 6.
http://support.microsoft.com/default...b;en-us;817248
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Jul 11th, 2007, 02:49 AM
#7
Thread Starter
Frenzied Member
I'll Be Back!
T-1000
Microsoft .Net 2005
Microsoft Visual Basic 6
Prefer using API
Jul 11th, 2007, 03:34 AM
#8
Thread Starter
Frenzied Member
Re: C# and VB6
Actually, I have a question on this.
I successfully got the example to work. However, it seems the dll file that gets produce is not the regular type that you can use Regsvr32.exe. How do I transport this to a machine that does not have .net and only VB6?
Also, it is interesting that you can only do this example with VB.Net and not C#.net. There is simply no COM Class for C#.
Thank you
Last edited by Liquid Metal; Jul 11th, 2007 at 03:40 AM .
I'll Be Back!
T-1000
Microsoft .Net 2005
Microsoft Visual Basic 6
Prefer using API
Jul 11th, 2007, 08:36 PM
#9
Thread Starter
Frenzied Member
I'll Be Back!
T-1000
Microsoft .Net 2005
Microsoft Visual Basic 6
Prefer using API
Jul 11th, 2007, 08:49 PM
#10
Re: C# and VB6
Originally Posted by
RobDog888
That link was available in one of those (in the second to be exact) that I posted like half a day earlier.
Last edited by RhinoBull; Jul 11th, 2007 at 08:53 PM .
Jul 11th, 2007, 08:59 PM
#11
Re: C# and VB6
Originally Posted by
Liquid Metal
Also, it is interesting that you can only do this example with VB.Net and not C#.net. There is simply no COM Class for C#.
Thank you
You need to create a Class Library project as suggested in links I posted for you.
Also, here is an image.
Attached Images
Jul 12th, 2007, 01:41 AM
#12
Re: C# and VB6
Originally Posted by
RhinoBull
That link was available in one of those (in the second to be exact) that I posted like half a day earlier.
Ah, so it is. Should have pointed it out.
VB/Office Guru™ (AKA: Gangsta Yoda ™ ® )
I dont answer coding questions via PM. Please post a thread in the appropriate forum.
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it!
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6
Jul 12th, 2007, 04:21 AM
#13
Thread Starter
Frenzied Member
Re: C# and VB6
Originally Posted by
RhinoBull
You need to create a Class Library project as suggested in links I posted for you.
Also, here is an image.
I did.
Got it to work with VB.Net but try to do it with C# and you will notice there is no COM class object for C#.
Just do the example but use C# instead.
I'll Be Back!
T-1000
Microsoft .Net 2005
Microsoft Visual Basic 6
Prefer using API
Jul 18th, 2007, 03:41 AM
#14
Thread Starter
Frenzied Member
Re: C# and VB6
Did you get a chance to check out what I mention Rhino?
I'll Be Back!
T-1000
Microsoft .Net 2005
Microsoft Visual Basic 6
Prefer using API
Jul 18th, 2007, 08:33 AM
#15
Re: C# and VB6
No, sorry - I was sort of away for awhile. Will give it the try if I scramble some time today, tomorrow... Can't promise tho...
Jul 19th, 2007, 03:40 PM
#16
Thread Starter
Frenzied Member
Re: C# and VB6
Beside the question that C# does not support COM, I found another discovery.
When I create a COM in VB6 and if I come back and delete a pass in argument, that breaks the interface right? I am sure you will agree with me on that. That means that you will have to recompile and a new GUID gets created.
When I create a COM in VB.Net and break the interface, it still uses the same GUID after I compile.
Why is that?
I'll Be Back!
T-1000
Microsoft .Net 2005
Microsoft Visual Basic 6
Prefer using API
Jul 20th, 2007, 11:58 AM
#17
Thread Starter
Frenzied Member
I'll Be Back!
T-1000
Microsoft .Net 2005
Microsoft Visual Basic 6
Prefer using API
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Click Here to Expand Forum to Full Width