Importing VB.net project A into VB.net Project B - vb.net

Could someone point me in the direction of importing a project into a project. Any information on how to use it would be great as well.
For example I have Project A that I could use to work within Project B. I have no idea what the correct form is for calling this in.
Any links would be more than helpful as well.
I am working in VB 2010
First Edit:
I do have an add reference option, but no add project option. Im assuming i shall go with reference and see what I can do.

Right click on the solution in the Solution explorer and Add --> Existing Project should work
Or file from the main menu Add --> Existing project

Related

How to set the startup project for an asp.net core template?

I am currently creating a multi-project template, I want to distribute using a .VSIX-extension for Visual Studio. When the extension is installed the user can select my template among the others provided by Microsoft in the "Create a new project" window.
My template consists of three project:
ProjectName.Server
ProjectName.Contract
ProjectName.Client
ProjectName is the user-given name while the suffixes "Server", "Contract" and "Client" are fixed. The issue I experience is that when the users create a new project the Client-project is always selected as a startup-project by default. I want the server-project to be selected as a startup-project by visual studio. It looks like following:
The client project is not the correct startup project, but users don't know that the server project it the correct startup project, so I want to take off the selection and integrate it right into the template, so the correct startup template is selected by VS when creating the project.
I already removed the suffix "Server" from this project, so it is shown as the first project in the solution explorer and I hoped VS would then select it as the startup-project. This did not work unfortunately.
Can anyone give me a hint on how to configure the startup-project in the template?
If you have any questions don't hesitate to comment.
These configurations are stored in the Solution User Options (.suo) file.
You can refer to my steps below to try:
First, Close Visual Studio and find the folder where your solution is.
Second, Open the .sln file with a text editor, you see all your projects encapsulated in Project – EndProject lines:
Third, Cut and paste the desired default startup items into the first.
Fourth, Delete your .suo file(hidden files: Solution Folder/.vs/Solution Name Folder/v17/.suo, I use VS2022).
Finally, Open your solution in Visual Studio.
You can have a try.
You will likely need to associate a custom IWizard assembly with your project template, and then explicitly set the startup project by setting the SolutionBuild.StartupProjects to the desired project in your solution.
Once upon a time, I did this using code similar to the following:
VSProject startupProj = FindVSProject(startupProjName);
sln.SolutionBuild.StartupProjects = startupProj.Project.UniqueName;
where FindVSProject was implemented as:
private VSProject FindVSProject(string projName)
{
foreach (Project p in _dte.Solution.Projects)
if (p.Name.Equals(projName, StringComparison.CurrentCultureIgnoreCase))
return p.Object as VSProject;
return null;
}

Using a 3rd party control

Please excuse the noobness that is probably about to follow...
I'm making an vb.net 2010 app which needs to have a calendar system in which the user can add appointments and events etc.
I've downloaded the source for a control which looks promising (http://www.codeproject.com/Articles/10840/Another-Month-Calendar) but I have no idea how to add this in to my project. I've googled for help on adding the control but have had no luck.
If I right click on my toolbox, go 'choose items...' and try and add it there, it tells me it couldnt be opened.
Any help is appreciated!
Well you've downloaded the source code.
Place the source code in a specific location on your pc and then compile it 9If your planning to use this control in your own project then compile it in release mode. Assuming that there are no compile errors close visual studio and then open up the project of your own that you want to use this control in.
Right click on the general tab in the toolbox and click choose items. Using the bowse button in the choose items dialog navigate to the folder in which you placed the source code for the control you want to use.
Now locate the 'Bin' folder and in that locate the 'release' folder. Inside that you will see a dll (named presumably something like MothCalendar.dll. Select that dll and then click add and OK (Button sequence will vary according to vs version). The control should then appear in your toolbox under the general tab and you should then be able to drag it onto your forms for use in your project.

User control type not defined

I'm having trouble adding user controls to my project.
I right-click on my project and select Add -> User Control...
I then click Add
I drag a label onto the new user control, and save it.
I build the project, go back to my main form, and drag the control from the Components tab in the Toolbox onto the form.
I see the control, but I get an error:
Type 'crm.UserControl1' is not defined.
If I do this with a blank project, it works. I'm not familiar enough with vb.net or visual studio to understand what's going wrong.
If I double-click the error, it brings me to this line in the generated designer code for the form:
Me.UserControl11 = New crm.UserControl1()
and says that crm.UserControl1 is not defined. If I change it to Global.crm.UserControl1, it works, but obviously this code is overwritten when I fiddle with the designer.
Any ideas, or pointers to get me started in the right direction? Thanks in advance.
My main form had the same name as the root namespace. This is what caused the problem.
Kind of late to the party with this one but I had this problem and I think that the issue was due to the controls being built in a more recent framework than the one that I was using.
Basically my custom controls were built in 4.7, but my project was being built in 4.5.1
Once I changed the current build so that they both were the same it compiled happily.
As far as I know, it is kind of accessibility issue because you are able to solve the issue when you try to access the object globally. I think when you drag and drop the control, the definition codes of the control in the designer class automatically generated with private accessibility but I don't know why. You could try to change it as public. I hope this will work.
Way late to this party. I fixed it by referencing it in the aspx page with the following as it was missing.
<%# Register Src="~/Controls/mycontrolname.ascx" TagPrefix="ucControl" TagName="MyControl" %>

Adding DLL reference to VB.NET project

Just to start off, this question does seem very similar to another post Add the DLL (lame_enc.dll) reference to my project, but I haven't been able to successfully apply that answer. I am pretty new to VB.NET so it is very possible I'm simply missing something obvious.
I am trying to link a DLL to a VB.NET 2010 project to allow my VB app to play *.ogg files. I followed some other advice here on the forums and downloaded FMOD's FMOD Ex Programmers API. I am trying to now reference that functionality. These appear to be the files I need to somehow reference.
C:\Program Files (x86)\FMOD SoundSystem\FMOD Programmers API Windows\api\fmodex64.dll.
C:\Program Files (x86)\FMOD SoundSystem\FMOD Programmers API Windows\api\libfmodex64_vc.lib.
I haven't discovered how to add a *.lib reference (or the equivalent), but selecting the DLL as a reference gives the following error.
A reference to 'C:\Program Files (x86)\FMOD SoundSystem\FMOD
Programmers API Windows\api\fmodex64.dll' could not be added. Please
make sure that the file is accessible, and that it is a valid assembly
or COM component.
I'm not sure what I could be missing. Any ideas? Thanks!
In Solution Explorer, double-click the My Project node for the project.
In the Project Designer, click the References tab.
Click the Add button to open the Add Reference dialog box.
In the Add Reference dialog box, select the tab indicating the type of component you want to reference.
Select the components you want to reference, then click OK.
Another approach I was trying is working for me. I found a site with a working example of a LibZPlay VB.NET sample ( http://planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=7789&lngWId=10 ). It runs under VS 2008 and I was able to adapt my project to use LibZPlay (open source library http://libzplay.sourceforge.net/WELCOME.html ) under VS 2008.
That is sufficient for me for now. Thanks for your advice. It was likely some configuration issue or misunderstanding on my end.
Using VB.net 2015 I (could not add or even find a System32 dll) as a reference using Solution Explorer, Tab References. Going to the MAIN Menu, Projects/Add References...
Used Browse and All the System32 dll were visible. Then I was able to load the needed dll.

Merging two VB.Net Projects

we are new to Visual Basic Programing, We are working on a project, which has modules. My team worked on these modules and prepared 3 separate Visual Studio Projects. Now, I want to combine then into one Visual Studio Project for Integration purposes.
We are using Visual Studio 2010.
In the solution explorer window (Default is top right) you will need to:
Right click on your Solution
go down to Add
select Existing Project
This will pop up a windows browser window, you will need to navigate to the place that you have the files saved, then click Open
Repeat steps 1-4 for all subsequent items.
Based on what you are saying, it sounds like youll need to add references to the modules in the main project:
Ensure that you are viewing all files in your solution by selecting Show All Files in the Solution Explorer
go down to References
click Add Reference - a window will pop up
in the top left, select Projects
in the popup window Right click on the Name of the project and select Add Reference
You should be good from here.
Your question is not clear wether or not you want to add the code from the individual projects to one project or add your projects to one solution.
In the first instance use the project that you want to be the main project and right-click on the project and select add existing item to select the .vb module file that you want to add.
In the second instance create a blank solution File -> New Project -> Other Project Types -> Visual Studio Solutions -> Blank Solution, then right-click on the new solution and select Add -> Existing project to add your projects