×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Must forms reside in the .exe or can I place then in .dll?
2

Must forms reside in the .exe or can I place then in .dll?

Must forms reside in the .exe or can I place then in .dll?

(OP)
I have been working on a programme in which the main .exe now contains 21 forms! Without creating a 50-form executable, can forms be designed within a .dll and called from the main .exe through code.

If so, how would the form be called?

Thank you!
Nick

RE: Must forms reside in the .exe or can I place then in .dll?

Some very large programs i.e. Accounting packages Use one main .EXE to call other .EXE's
Maybe that would be a workaround for you.

RE: Must forms reside in the .exe or can I place then in .dll?

(OP)
Possibly; however it would be necessary to prevent users from launching each .exe as a standalone. Folks are naturally curious and will do just that - by encapsulating the form/code in a .dll this is more easily prevented.

Calling the .dll and sharing info between forms would be problematic for me at this point in my experience.

Nicholas, Bank of America NetO


RE: Must forms reside in the .exe or can I place then in .dll?

Well in that case put a "Command" statement in each child .EXE that looks at how it was executed.
If it was launched from the main app pass an argument to the child.
Like so in the main
Private Sub cmdPayroll_Click()
Retval = Shell(App.Path & Payroll.exe & " /RunMe", 1)
End Sub

' In the child's (Payroll in our example) load event have
If Command <> "/RunMe" Then End


If it is run by itself then the "Command" will be blank. and the program will load and end without even showing up on the screen.

RE: Must forms reside in the .exe or can I place then in .dll?

You can place forms in a DLL, but you have to have a Public createable class in the same DLL with some code to show the form.

For example:

Public Sub ShowAccountingForm()
frmAccounting.Show
End Sub

You need to create a public method for each form that you have in the DLL. This does not always lend itself well, since most of the time forms are used for data collection. The problem is that all the data is on the form and now you have no way of getting it off of there, unless you create more public properties or methods for the form.

If the above example was in a Class called CForms, then to call it from the main program you would do this:

Dim objForms as CForms

Set objForms = New CForms
objForms.ShowAccountingForm
set objForms = Nothing

This would show the form. While it is do-able, it's probablly more trouble than it's worth. If you're really bent on doing it this way, I would create a public createable class for each from. Then I would declare all my public properites to match any of the input on the form. The problem comes in when you have a Combo box or List box where you have several things that need to go in it. At this point you're just wrapping the functionality of existing controls. This brings be back to the statement that it's probablly more trouble than it's worth.

-Steve

RE: Must forms reside in the .exe or can I place then in .dll?

VB Project: ActiveX DLL

The Form: frmMyClass

Option Explicit
Public FMyClass as CMyClass

Private Sub Form_Load()
With FMyClass
txtName = .Name
txtDescription = .Description
......
End With
End Sub

Private Sub Form_Unload()
With FMyClass
.Name = txtName
.Description = txtDescription
......
End With
end sub


The Class Module: CMyClass

Public Sub Show()
Dim F as new frmMyClass
Set F.FMyClass = Me
F.Show VbModal
End Sub

Roy Lofquist
roylofquist@msn.com

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close