Call PopupMenu VB.NET Framework 2.0 - vb.net

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)

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.

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.

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.

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"

Visual Studio Shortcut to Auto-Add Event Delegate Methods

In C# adding event handler methods is very easy. You just type "object.event +=" and then press tab twice.
Is there anything like this for VB projects?
Note: This is for dynamically created controls or controls that are not declared WithEvents.
You can select the object and the event in the top of the coding window and VB will automatically create the method for handling the event and hooking it up in the designer file. Besides from this there is no such feature available not with Visual Studio nor Resharper.
The C# development team added support for this, but for some reason the VB guys haven't gotten around to it yet, nor has I seen any third party addons doing anything like it.