Can only compile a VB6 DLL after opening a specific form in design mode - dll

ActiveX DLL project - running it or Menu > File > Generate Dllname.dll... both produce the error message: Error loading DLL
However, if I open a specific form in design mode then I can compile or run the project without problem.
The form has a MSCAL.OCX v11 Calendar inside.
Note that if I open any other object (classes, forms, etc) continue with the error when try to Run/Compile. Is mandatory to open the frmDate.frm object if I want to Run/Compile the project.
I don't understand why it has this strange behavior and if there is a way to solve it.

Do you have proper appointed the startaup point of the project?
You can do this using this path above:
Go to “Project”->” Properties “, and in the “General” tab select the appropriate form from the “Startup Object” list box.

Related

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.

Generate manifest for regfree COM from a VB project

I am trying to generate a manifest for a set of COM objects that are being used in our code as registration-free COM.
For that purpose I created a VB project in VS 2010 and added the COM objects DLLs as dependencies. The problem is I do not see them listed as dependencies in the generated manifest. Am I missing something simple like a project setting to generate the proper manifest listing the dependencies?
You left out too many details and the VB.NET IDE hides too much to do this right. It is not automatic.
Starting point is to force it to show more. Locate the "Show All Files" toolbar button in the Solution Explorer window (use the tooltip to find it back). Click it and you now get the "References" node added to the project.
Open it and locate the COM component that you added to the project. Select it and look at the Properties window. Set the "Isolated" property to True. Rebuild the project. Be sure to look in the Output window for any warnings. And to look at the .manifest file on disk instead of the one the IDE shows you if you added a manifest to your project yourself.

What is ApplicationEvents.vb file from

Just noticed a file named ApplicationEvents.vb in my vb.net project in the solution explorer, its empty...
Where would this have come from? is it safe to delete?
It is a file that can house common Application events like Startup and Shutdown. This is a partial class, so it would get compiled in when building the solution.
If it is empty, then it is safe to delete, but if you ever want to handle these events, then this is where you can easily hook into these events.
Read How to: Handle Application Events (Visual Basic) for more information.
Im using visual studio 10
The applicationevents.vb is not safe to delete if its empty. The project will fail to build properly because the file is missing. The project has some kind of internal reference to the file if you have created it. By default this file is not included unless you have clicked the "Application Events" button on the application tab in the project properties....
what I really want to know is why is mine blank....

VS 2010 Error Opening Design View

There is no editor available for 'file path here'. Make sure the application for file type (.vb) is installed.
This is the error that I get when I try to open a project I did a while back in VB. I tried a C# project and I can open the form for viewing fine, but for some reason VB won't work? Any ideas? I really don't want to do a repair on the whole application as it takes a while and I'm not even sure I have the ISO right now.
Check the compile mode of the object. If it is not set to "compile" then VS gets a bit weird about opening it up.

Clicking and draggging a user control in VB .NET creates object reference error message

Failed to create component 'User Control 1'. the error message follows:
'System.NullReferenceException : Object reference not set to an instance of an object.
at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object Component, Object Value)
.............. etc..........
What should I do to fix this error?
When a User Control won't load into the Visual Studio designer here is what you need to do. These instruction are for vb.net project but c# should be similar. Also, before doing this close all open windows (or at least the source and designer files of the control you are working on.)
One last thing. The FIRST thing you should do is ensure that restarting visual studio doesn't fix the problem. If not you can try the steps that follow. These instructions assume that the errant user controls are in control library project in visual studio. If not you should be able to adjust the directions a bit to get it to work but it is much easier when the control is in its own project.
Do the following:
Make the control library your startup project.
Open the properties for the control library project and click on the debug tab.
Under Start Action click the Start external program option and browse to the Visual Studio executable.
NOTE: what this means is that when you run your solution it will fire up another instance of Visual Studio instead of actually running your solution. The First Instance of Visual Studion (INSTANCE_1) will "host" a second instance of visual studio (INSTANCE_2) when you run it.
Run your solution. INSTANCE_2 will load.
Switch back to INSTANCE_1.
In INSTANCE_1 hit CTRL-ALT-E. This will open up the exceptions dialog box. Check On the THROWN column checkbox next to Common Language Runtime Exceptions.
NOTE: This will ensure that INSTANCE_1 will BREAK at ANY runtime error even if it is hit in a try block.
Switch to INSTANCE_2. In Solution Explorer double-click to open the errant user control.
You should find that INSTANCE_1 OF Visual Studio should have stopped at the line of code that caused the designer to not load the control. Fix the code (which usually means testing for IsNot Nothing before references an object properties...but could mean other things.)
Also, sometimes I find that the control WILL load in INSTANCE_2 instead of breaking on an error in INSTANCE_1. In that case just stop debugging...close INSTANCE_2. Save/Restart INSTANCE_1 and your problem will often have gone away.
The lesson is this. User Control MUST be able to load/reference all objects and their members in order to load it into the designer. So for User Controls that will be placed onto other containers I will usually design events to notify the parent rather than trying to push objects into the child control.
Hope this helps for future reference on this old question.
Seth
Instead of the error occurring when you open up a form for editing, it sounds like this is occurring when you are already editing a form and adding new user controls. A CodeProject article that was previously mentioned shows what to do in the case of a form not loading correctly, rather than a specific user control.
Does your user control have any properties that map to custom objects (i.e. not Integer or String)? If so, the Form Designer will attempt to load your properties into the Property Editor. If showing the properties generates an error, the Form Designer will show that to you. I think this is what is happening with your user control.
If you could edit the question and add more information about the nature of the error (more of the error text), it would assist others in helping you better. Alternatively, see if you can find the property that might be causing the error (e.g. whether any property relies on a non-null value being set). You can also take a look at this MSDN article for tips on how to limit the control for just run-time.
Thanks, Seth, for this post! Your solution helped me nail down the error. The only thing I would add to this is that when "INSTANCE_2" loads, you may need to actually load the project file in INSTANCE_2. I needed to because I wasn't dealing with a control library, but instead had custom User Controls defined in the same project that the forms were located in. Once I loaded the project in INSTANCE_2, I opened the erring form and that caused INSTANCE_1 to pop up to the line of offending code in the User Control.
I have found that this error often occurs when control dlls are not building properly. 95% of the time this is remedied by simply restarting Visual Studio.