converting GUI of vb6 - vb.net

Thanks a lot for the received answer.the following is brief description of how my project works.
GUI is used to collect information from User and validates.have got dll named controlclass that pass input data from GUI to Business logic DLL.this dLL connect to the database and saves data.after that,it disconnected and takes the results to the control dll,then to GUI which interprets if the input data was successful or not.Is there a tool that can be used to convert VB6 GUI to .net web forms?
am not familiar to vb.net.how do you create reference to vb6 dll or COM from vb.net?

In order to create a reference to a VB6 COM object from VB.NET:
Select Project>[Your Project] Properties OR Double Click on My Project in the Solution Explorer window
Select the References tab
Click Add
Select the COM tab
Select the component you require
You will notice that Visual Studio will creates an Interop assembly which handles the interfacing to the COM object for you.
From that point on accessing the COM object is the same as VB6
Dim obj as New MyObject
obj.DoSomething
'etc
Set obj = nothing

Related

Using COM object in VB

Trying to find how to tell VB to use COM object. In C# it is quite simple - select Add Reference - > COM -> select library you need and add simple code like this:
AMyClass c = new AMyClass();
int i;
c.A_Myfnc(out i);
It works fine in C#.
How to make the same in VB?
I stuck in when I was trying to add COM object reference in VB 2012. Where is exact place where I can add my OCX reference? I was trying to ad component to toolbox, but in could not find my component in COM tab list. My COM is not visual.
Then I tried to use VB 2013. There I found that I can add reference in solution explorer like in C# and I see my component registered. That is fine, but what is syntax of creating COM object in VB?

Cannot create VB6 ActiveX dll

I am trying to create a simple VB6 ActiveX exe and call it from Excel.
In VB6 I create an ActiveX DLL project called BigTrev, using all the default settings.
I create a MultiUse class called Trev with a single method containing no code
Public Sub HelloWorld()
End Sub
I make a DLL and register it from the command line (VB6 also registers it for me but I did it using cmd as well anyway).
Then it Excel I create a reference to my DLL in a new workbook. It clearly has been registered because the Intellisense knows about Trev and HelloWorld.
Sub cats()
Dim derek As BigTrev.Trev
Set derek = New BigTrev.Trev
derek.HelloWorld
End Sub
It compiles in Excel, when I step through it it fails in the second line, the Set one. Error message is "ActiveX component can't create object".
Why? I have done this or similar loads of times many years ago when VB6 was used widely, I am using Windows 7 now and I am an admin on my box.
I would suggest registering the DLL (or EXE if that's the direction you've chosen) with the relevant regsvr32.exe. In this case, where you're registering a 32bit DLL for use in 64bit environment, use the one hiding out in c:\windows\syswow64.
Sadly, I don't have Excel (shock, horror) and the spreadsheet I do have (LibreOffice) is 32bit.

Call PopupMenu VB.NET Framework 2.0

I have a project that I have converted from VB6 to .NET, using Visual Studio 2008 with the framework 2.0. In VB6 you can call a PopupMenu like so:
Call Me.PopupMenu(mnuEstimating)
I tired to use the same code in .NET but I get the error:
'PopupMenu' is not a member of 'frmEstimatePriority'.
I have looked around on the web and have seen ContextMenuStrip being used in place of this. I would like not to have to add another/new object to the form designer if I don't have to. Is there another easier option besides ContextMenuStrip?
Can someone please tell me how to open a PopupMenu in VB.NET?
Assuming the form has a ContextMenuStrip control with menu items, try:
Me.ContextMenuStrip.Show(MousePosition)

Populate fields in VB6 executable from MS office VBA

I'm developing a VB6 standalone application that I'd like to be able to call from VBA modules running in Excel, Outlook, etc. Ideally, I'd like the VBA module to check whether the VB6 application is already running, if not, open it, then populate certain controls (textbox, listbox, etc) in the VB6 application with information from the VBA module. Is this even possible? Can I just create a reference somehow to the VB6 application, then treat it like any other object? Thanks for your help!
Make the Vb6 app into an ActiveX Exe project. Here's the VB6 manual tutorial on creating an ActiveX exe. Add a reference to the vb6 from the VBA code. You will be able to call into objects in the Vb6 from your VBA.
Use GetObject to instantiate a Vb6 object from the VBA. That will connect to any existing instance of the vb6 app, or start a new instance if necessary.
You cannot do as you describe and treat the VB6 app like and object but you could do it in the following way:
Use the FindWindow API call to determine if the VB6 application is running
Use the Shell command to start it
Use AppActivate to make VB6 window active and SendKeys to send the data to it
That would be the simplest "out of the box" solution. However, this will be quite brittle. For example, if you removed controls from the VB6 form or changed the tab order of the controls, your app will malfunction!
Another option is DDE but I think the DDE link is intended to go from the VB6 app to Word or Excel, not the other way around.

Loading a Vb.net control inside a VB 6 form

I have a user control in vb.net application.
and i have a form in vb 6.
so in my vb.net applciation to this user control i need to mention the vb 6 form as its parent.
Means when i run a vb6 application i should see this user control as a part of that form.
Ahy help appreciated.
Take a look at the COM interop Toolkit.
It allows you to easily create com-visible .NET usercontrols, which can be used in VB6 for instance.
You can try saving it as a dom object in .net
After this, you can open it in vb6 in the menu components.
I've done it with guid class of .net but i donĀ“t know what you and to do, but i think you should try it.
It is actually fairly easy to add some plumbing to a VB.NET User control to expose it via COM as an ActiveX control that can be used by VB6 and other COM clients.
Here is an article describing how to do that:
"Writing an ActiveX Control in VB.NET"