Loading a Vb.net control inside a VB 6 form - vb.net

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"

Related

Reparent controls from a .NET form to VB6

Good morning. I've got an interop .NET form that I can create and show inside a VB6 project. Now, I would like to open the form in "MDI mode". I've got a control that allows me to achieve this result. Unfortunatly it seems to work only with standard VB6 forms. So, the test I would like to try is to copy the content of the .NET form inside the VB6 one... Do you have any suggestion on how to deal with this situation?
Thank you!
The way you are doing this is asking for trouble - it's a bit hacky. It would be better to use supported mechanisms as far as possible.
You would be better off if you create a .NET UserControl with the GUI you want to display, and make it COM visible. You then can instantiate the control in a VB6 form, which would fully support the way that MDI is supported in VB6.

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)

How to force visual styles when using .NET forms Interop from VB6

I have created a VB.NET Class Library that exposes some COM Interop sub routines. These in turn show various forms that are contained within the Class Library. When the forms are shown from VB6 they do not inherit the visual styles of the operating system and act like VB6 controls.
I gather that this probably by design but is there some way to force/control visual styles manually in the .NET assembly? I would imagine that if I use a manifest in my VB6 app then everything will use the correct style but I would like to be able to control this myself if possible because we are using 3rd party controls in VB6 that do not require a manifest.
I think the manifest is the way to do it, but first, you could always try this:
Add a reference to Windows.Forms and call these two methods in your assembly entry point:
System.Windows.Forms.Application.EnableVisualStyles()
System.Windows.Forms.Application.DoEvents()
Note: We call DoEvents() because there was framework bug which caused errors and badly drawn styles. I believe this has been fixed since, but just in case.

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.

How to get selected text from a webpage?

I need to retrieve only selected portion of a webpage (user open a webpage in web-browser control, then he/she would select some portion of a webpage, i just need only those selected portion/text) in vb.net in visual basic language. How to do ?
i am using microsoft visual studio 2008
Language: Visual Basic
FrameWork: vb.net 3.5
Perhaps here are some answers for you(first post attachment):
Manipulate/Change/Form Fill data in webpages using the Webbrowser control
In terms of IE's API, you can get the select text by getting the selection object via IHTMLDocument2::Selection the property, then create a range object via IHTMLSelectionObject::createRange. If the return range's type property is "Text", you can then query IHTMLTxtRange from it and get the selected text via IHTMLTxtRange::text.
It is unclear which webbrowser control you are referring to. There are 3 webbrowser controls in the .Net Framework, one in Windows Forms, one in WPF, and one in Silverlight. Anyway, you can call InvokeScript or use the unmanaged interface like csexwb's GetSelectedText, if one of the method is supported by your control library.
Next time mention which control library you are using when you ask the question. Merely mentioning the language you choose isn't enough to resolve the ambiguity in class names.