How to call parameterized function from the dll in VB.Net - 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.

Related

stimulsoft report add my function with vb.net

we can add our function with this way
https://www.youtube.com/watch?v=TEYuQmia9IY
but it in c#
i want the way in vb.net
the problem in using namspacing in vb.net
thanks
In the video posted there are some critical steps missing. It seems that they are given for granted but without it you could not achieve a successful reference to your code from the Report Designer.
First: To clarify the problem between VB.NET and C#. If you want to use VB as scripting language for your report you need to set it in the Report Properties. You will find the ScriptLanguage property in the same property grid for the report where they set the reference to your application. Changing this property is not required because this property refers to the code written inside the report not the code in which you have written your app.
Second: In your VB.NET app your code that defines the function should be as this
Namespace MyFunc
Public Class Main
Public Shared Sub ShowMessage(text As String)
MessageBox.Show(text)
End Sub
End Class
End Namespace
Usually in VB.NET you don't define explicitily a namespace (everything is inside the main namespace defined in the project properties) but if you want a separate namespace there is nothing to stop you.
Third: In the Report Code Page you write
Imports WindowsFormApplication2.MyFunc
Fourth: After completing the design of your report remember to save it in the same folder where the application is created. (Usually Project\BIN\DEBUG) Otherwise the reference to your executable will fail.
Fifth: The Stimulsoft assemblies are installed in the GAC, but to be sure that they are found when you run the report don't forget to set their references to Copy Local = True when you run your app inside Visual Studio

Create Form in DLL using C++Builder

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.

Public properties from another class in vb.net

I've tried searching... a lot for the answer, but as I'm not too sure what exactly I'm trying to do I can't seem to find anything.
I'm trying to write a dll in order to handle errors thrown from a vb.net app. In the dll I need several forms (I'm not totally sure if they can have forms - I'm a bit of a newbie when it comes to dll's) for which the user can type in their message about the error and submit it.
I need to be able to pass strings to the form and for the form to be able to access public subs in the class file.
For instance I have a public sub called Emailer, which I want, when the submit button is clicked from the form to be run.
Or, lets say I have a public string:
Public strName as string = nothing
why cant I, from the class file just do this:
frmFormName.strName = "abc"
Not sure if I've explained that very well, but like I said I'm a bit of a newbie with this stuff.
1) You can have froms in a DLL it just does not have a entry point you will need a exe for this this. Which it sounds like you have
2) You will need to add a project reference to a dll from your exe
ok not sure how this will work but try to download this Example project let me know if you have more questions

How do I call a macro function in a global template/add-in from another template?

First, I am a VBA newbie. So please pardon my ignorance.
I have a global template that I installed in the Word startup folder.
The global template has some macros that I would like to access. But I can't figure out how to access the macro.
I tried to use Application.Run, but that doesn't work (or at least I'm doing it wrong). I keep getting Runtime Error 424.
I also tried to use something like Call globaltemplatename.modulename.functionname but that doesn't work either.
I also tried to simply call the function but then it says that the function/sub is not defined.
LOL... um... nvm... I found out why...
I didn't create a reference in the template that I was calling from...
Well...in case anybody else runs into this problem, you have to open the template (not the global template) and then go to Tools > References in the VB editor. And then check the project name of the global template.
sTemp = Application.Run ("modulename.functionname")
The entire string is in double quotes.
Word does not want the templates name - leave it out.
Even more Word do not let you use more than ModuleName.ProcName. Otherwise a runtime error will be thrown.

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.