Create Form in DLL using C++Builder - dll

I want to create a DLL that exports a function that will show a Form to the user. Does the VCL allow this use, and if so, then how is this accomplished?

Quick Answer: Yes
Create a DLL in the IDE, ensure that you have selected to use VCL in the DLL creation wizard. Again, in the IDE, add a new VCL Form. You then have to create a function callable from outside the DLL to create the form and show it.

Related

How to call parameterized function from the dll in VB.Net

I have visual c++ .dll file which I have added as the reference in VB.Net project. That created Interop.mydlllib.dll.
Now I want to use the function having three parameters from dll inside my one function.
How to call this VC++ dll function inside my VB.Net function.
I'm very new to VB.Net, so any help is appreciated... :)
(I searched on the internet and tried the ways suggested there...but still error ... :( )
If you've referenced a Dll inside a VB project, then you will simply need to call it from it's namespace.
I.e. inside the C++ project there will be something (Probably the application/dll name) that it will register itself under.
From here, you simply need to start typing for intellisense to kick in and you'll see the name of your Dll listed in the dropdown list. Select that name and you should see your function name that you'll be able to call.

Cannot create VB6 ActiveX dll

I am trying to create a simple VB6 ActiveX exe and call it from Excel.
In VB6 I create an ActiveX DLL project called BigTrev, using all the default settings.
I create a MultiUse class called Trev with a single method containing no code
Public Sub HelloWorld()
End Sub
I make a DLL and register it from the command line (VB6 also registers it for me but I did it using cmd as well anyway).
Then it Excel I create a reference to my DLL in a new workbook. It clearly has been registered because the Intellisense knows about Trev and HelloWorld.
Sub cats()
Dim derek As BigTrev.Trev
Set derek = New BigTrev.Trev
derek.HelloWorld
End Sub
It compiles in Excel, when I step through it it fails in the second line, the Set one. Error message is "ActiveX component can't create object".
Why? I have done this or similar loads of times many years ago when VB6 was used widely, I am using Windows 7 now and I am an admin on my box.
I would suggest registering the DLL (or EXE if that's the direction you've chosen) with the relevant regsvr32.exe. In this case, where you're registering a 32bit DLL for use in 64bit environment, use the one hiding out in c:\windows\syswow64.
Sadly, I don't have Excel (shock, horror) and the spreadsheet I do have (LibreOffice) is 32bit.

How to Reference A DataTable From Application to DLL

Goal
I have a main application that generates numbers for the company. I will be using this number generation in my main application and in an AutoCAD plugin. That being said, I created a class library (DLL) that will be utilized in both places. This prevents me from making modifications in both places if ever I need to. I just open the DLL, make the changes and rebuild.
The information is stored in DataTables and I want to use my main applications' DataTables as a reference in my DLL class library.
Current Situation
When I edit an item from my main application, I use the DLL to prompt the edit window (this is what is used in my application and my AutoCAD plugin). Once the user is done, they save the changes. The only issue is, the DataTables in my main application are not modified, only those in the DLL. Therefore I do not see the changes replicated.
From my main application, I call the Dll.Initializer.InitializeDataTables() to load the information in my DataTables. This is the same code I utilize in my main application load as well, I know this isn't the way to go. This is why I'm looking to some sort of reference between the DataTables.
Public Class Initializer
Public Shared Sub InitializeDataTables()
'The following Loads information in the DataTables
clsPlatform.LoadPlatform()
clsState.LoadStates()
clsEmploye.LoadEmploye()
clsClient.LoadClient()
clsArticle.LoadArticle()
clsLayout.LoadLayout()
clsCountry.LoadCountries()
clsOffice.LoadOffices()
clsProgramVariable.FillAppEngs()
myApplicationEngineers = clsProgramVariable.GetAppEngs()
End Sub
End Class
How can I reference the DataTables so when a change is done in the DLL, I can see it replicate in my main application?

Umbraco create macro of .NET Composite Control

Been struggling with this for a while now..
I'm perfectly able to create a working .NET Composite-control, which works fine in an aspx website.
I'm able to create in umbraco a macro for a .net homemade user control and pass parameters to it, this works fine on the umbraco-website as well.
Problem is the combination of both. I would like to create a macro in umbraco for the composite control I've created, but I'm not able to get it right.
Here I chose '.NET Custom Control' because my composite-control is a vb.class only (and the '.NET user control needs an .ascx page) As Assembly I chose the name of the dll (without the extension As Type I took 'NAMESPACE.CLASSNAME'
But then I'm getting this error:
'System.NullReferenceException: Object reference not set to an instance of an object. at umbraco.developer.assemblyBrowser.Page_Load(Object sender, EventArgs e)'
What I'm doing wrong here?
Thx.
Did you try it with .dll in assembly name? also whats is your namespace and name of the class?
Regards
Isamil

Referencing user controls that are contained within the same VB.NET project

I do apologize if this post is a duplicate, but I haven't found anything similar when I searched.
I'm fairly new to VB.NET and I'm currently playing around with user controls, figuring out good programming practices. As far as I understand, to create and use a UserControl, I need to create a project with the UserControl in it, then build the project and use that DLL (add it to Toolbox or otherwise).
My question is this: Is there a way a have a project (a Form with a bunch of things on it) that contains a UserControl written in a *.vb file inside that same Project? If you do that, the DLL (in my case) never gets produced, possibly because the UserControl is never used and building it is simply omitted. Is it perhaps a bad practice to do that altogether? It simply makes sense to me to keep a UserControl as a part of the Project that uniquely uses it. Is there a reason not to do that?
Thanks in advance! = )
SOLUTION:
Visual Studio does not automatically include your own controls to the toolbox by default! In order to change that, go to Tools>Options>Windows Form Designer>General and set AutoToolboxPopulate to True. When you build your project next time, your new Control will appear in your Toolbox.
It's a perfectly valid design decision to include a UserControl in a WinForm or WPF project that uses it. If you do this then VS will not create a DLL for the UserControl; instead the UserControl will be built into the assembly your project is producing.
If you did want to reuse a UserControl in multiple projects then you would want to create separate project that generates a DLL that can be reused.