Visual Studio running wrong form class - vb.net

In Visual Studio 2010 express (using vb.net) I've somehow set two forms to use the same class.
Basicly I have two designer files with 1 implementation each. For some reason both designer files are calling the same implementation file, and I can't find any settings to correct the problem. Help!

Related

GetActiveObject is not a member of Marshal

I'm working in vb.net in Visual Studio 2017. I'm fairly new to visual basic. I'm more familiar with VBA.
I prototyped code to access Autodesk Vault 2019, download a file, and open it in Autodesk Inventor 2019. This code was created with an Autodesk Inventor AddIn template in visual studio. The code compiled without errors and functioned as intended.
The final intention of this application is to compile the code to a DLL and then call that DLL (with arguments) from VBA in another piece of software (CorelDraw). In order to do this it is my understand that I need to place the code in a class library template in order to have it compile to a DLL correctly.
While doing this, I have an issue with the following line of code:
ActiveInvApp = Marshal.GetActiveObject("Inventor.Application")
"Marshal" is from "System.Runtime.InteropServices" which is imported at the beginning of the application with the following line of code:
Imports System.Runtime.InteropServices
The issue is that Visual Studio doesn't recognize "GetActiveObject". It highlights it with a red squiggly line. When I hover over it with the cursor it shows the tooltip: "'GetActiveObject' is not a member of 'Marshal'".
At the time of writing this I have two instances of Visual Studio 2017 open. One with the class library version of this code and one with the Autodesk Inventor AddIn version. The AddIn version does not have a problem with this line of code and the class library does.
Per some instructions on creating a DLL class library, my code starts with the following:
Namespace VaultCOMFunctions
Public Module StringLibrary
<Extension>
Public Sub OpenFromVault(PartNum As String)
'Code for opening the file goes here
I'm not sure if that's relevant or not. Like I said, I'm somewhat new to VB.net.
I've spent a good deal of time messing around with references to try to clear this up, but with no luck. What could be causing this? I can't find any existing forum posts (here or elsewhere) with any kind of a similar issue.
The answer was posted by #Simon_Mourier in the comments on the original post. The Visual Studio project was targeting .NET Core. To fix the issue I simply switched the project to target .NET Framework and the error went away.
Check the version of .NET Framework you are targeting. GetActiveObject was removed after .NET 4.8.
https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.marshal.getactiveobject?view=netframework-4.8

VB or VB.NET? How do I know which one to use

I need to make a windows app. Should I use VB or VB.net? What is the real difference actually? I downloaded visual studio for vb and right now I have "microsoft visual basic 2010 express". I'm assuming if I want to use VB.net it'll say "microsoft visual basic.net 2010 express". Where do I get that from though?
COM-based VB (i.e., "VB6") is obsolete and no longer sold.
VBA is only part of another app or product (such as Excel, Word, etc.) that hosts it and is not appropiate for a stand-alone app.
VB.Net is current, available for purchase (as part of Visual Studio), and supported.
So use VB.Net.
Visual Basic 2010 Express is the IDE to write VB.NET code. You already have the correct program.
As you're starting now - why not use the newest Visual Studio Express 2012?

visual studio 2010 with c# like namespaces in vb

Is it possible to have visual studio 2010 automatically add namespaces to classes within folders just like c#?
No this is not possible with the VB.Net project system. I would encourage you to share this opinion with the Visual Basic IDE team. They closely monitor suggestions and I know this has come up in the past (although I don't know if there is a current outstanding request for it).
http://connect.microsoft.com

Visual Studio 2010, using VB.NET. Intellisense does not recognize new property until I recompile

I have an ASP.NET VB.NET web project that references a VB.NET class library.
I add a new property to a class in the class library, then, from the web app, I expect to be able to use it immediately w/o errors and with full intellisense.
It used to work in 2008.
When I compile the class library, it becomes available but not until.
Was this nice feature taken away, perhaps in the interest of speed?
What's likely happening here is that the Class Library and ASP.Net applications are targeting different versions of the framework. If they are using incompatible versions of the framework then VB.Net will treat it as a file reference instead of a project reference and would give you the behavior you're seeing.
Right click on the project, select the Appilication Tab and make sure that both have the same value selected for Target Framework. That should fix the problem.
Visual Studio 2010 will officially launch on April 12, 2010. I'd say there's a good chance that problem will be fixed in it. Go see.
EDIT: corrected the date.

Create VS2008 Plug In with VB.Net?

Anyone know of any examples on creating plug in's for VS2008 - preferably with VB.net?
If you can wait for VS2010, it should be lot easier because of new extensibility framework they use (MEF). Basically the extensibility hooks are now managed and are very decoupled.
Otherwise, I know this framework. I have never used it.
Or you can use the "Visual Studio Add-in" project template included in VS2008 ( File > New Project > Other project types > Extensibility > Visual Studio Add-in). It is hard to learn and debug, but it works.
Finally, if it is for internal use, you can just create simple VS macros that reference normal .Net assemblies. This is how I do internal extensibility projects because there is zero friction. You just create small macros that call your assemblies (to show a Windows Forms dialog for instance). Then you add that macro to VS toolbar or define a keyboard shortcut for it.
I hope this helps