Call mechanism

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Hi all

We are new to coding in VB after many years COBOL (yes i
know!!!). Anyway esentially we are trying to have a
simple .exe program that will call relevant .dll's when
required.

The .dll needs to have a full interface including Menu's
but can't seem to ge this to work. I can create a user
control and call that but of course this can not have a
menu! Is there any way a dll can contain a windows form
and still be called?

Hope someone can help

Martin
 
There are many seemingly conflicting comments in this post.

First of all the newsgroup you have posted to is VB.NET which uses the >NET
framework. If you are coding in classic VB then you need to go to one of
those groups.

If you are coding in .NET, then the .NET provides everything you need to
code up windows forms etc.

Can you be more explicit about what you are trying to acheive , because it
sounds like you are trying to acheive.


OHM
 
* "Martin said:
We are new to coding in VB after many years COBOL (yes i
know!!!). Anyway esentially we are trying to have a
simple .exe program that will call relevant .dll's when
required.

The .dll needs to have a full interface including Menu's
but can't seem to ge this to work. I can create a user
control and call that but of course this can not have a
menu! Is there any way a dll can contain a windows form
and still be called?

Just create a class library project, add a reference to
"System.Windows.Forms.dll" and some other libraries which are needed for
Windows Forms, then design your forms + menubars in the DLL.

Later you can reference the DLL from within your EXE project and
instantiate the forms defined in the class library.
 
Yes we are using vb.net, sorry should have been more
explicit!

I am happy coding windows forms without a problem. The
problem arises because i want the forms to be in
individual .dll files (or any other file type) so that
they can be called when needed without having all the
forms in the main .exe program.

hope this makes sense!
 
-----Original Message-----
* "Martin" <[email protected]> scripsit:

Just create a class library project, add a reference to
"System.Windows.Forms.dll" and some other libraries which are needed for
Windows Forms, then design your forms + menubars in the DLL.

Later you can reference the DLL from within your EXE project and
instantiate the forms defined in the class library.
We have created a class library project with a user
control and can reference that fine. Problem is that
does not allow menu bars and when we try to use a normal
form within the .dll it no longer references it.

Are there any examples that i could view? AS i say very
new to this so if we can get an idiots quide to this it
would be very useful!!!!

Sorry if we are thick!!!!
 
OK Martin, I see what you are trying to do now, sorry if I didnt read you
correctly. This is something I havent had the need to do so I'm not able to
offer any help at this point.

Appologies if I wasted your time with my post, have you tried googling this
query ?

Good Luck and Regards

OHM
 
OHM,

This is a typical way of MS-cobol (and the sames) of Dos programming.

I made 4 times an answer and 4 times I did stuff it.

I did make an answer, because I think it is not the way it is done in
VB.net, but I can be wrong and there are more who do this, therefore I did
stuff it.

Doing it in this way makes is very efective for memory use, so you can stay
easily under the 1Mb from Dos with a lot of forms (with extended memory).

I think, that is something a VB.net programmer never thinks on anymore,
because he uses the windows deskop and things like the Start menu and memory
there is enough.

I did want to give an answer that using the MDI is something the same, but
that is not true either, althought that is the menu problem.

Just for your information.

Cor
 
Thanks Cor.

I guess, they beleive that they have a need to do this, and they have as
valid a reason to pose this question as anyone else. It just probably
wouldnt be something I would likely want to do ( as yet anyway ).

Have a good day

OHM
 
* "Martin said:
We have created a class library project with a user
control and can reference that fine. Problem is that
does not allow menu bars and when we try to use a normal
form within the .dll it no longer references it.

What do you exactly mean with "it no longer references it"? The type of
the project must still be "class library".
 
Hi all

We are new to coding in VB after many years COBOL (yes i
know!!!). Anyway esentially we are trying to have a
simple .exe program that will call relevant .dll's when
required.

The .dll needs to have a full interface including Menu's
but can't seem to ge this to work. I can create a user
control and call that but of course this can not have a
menu! Is there any way a dll can contain a windows form
and still be called?

Hope someone can help

Martin

As others have said - you simply create the form in a class library.
You need of course make sure that your library references System.Drawing
and System.Windows.Forms so that it can create a form - but other then
that it should be fairly strait forward...

' dll
Imports System.Drawing
Imports System.Windows.Forms

Namespace MyNamespace

Public Class MyForm
Inherits System.Windows.Forms.Form


....
End Class

End Namespace


' exe

Imports System.Drawing
Imports System.Windows.Forms
Imports MyNamespace

Public Class App
Public Shared Sub Main
Application.Run(New MyForm())
End Sub
End Class
 
Back
Top