Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 1st, 2006, 01:25 PM
Registered User
 
Join Date: May 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Form in a DLL file for VB6

  Hi there . . .
  I´m trying to create a simple DLL in VB, but it have to contain a FORM (simple one) and I have to call this form from the EXE (also in VB).

  . . . is there some one here who can help me ?
  (a simple code example will be welcome)

  Panosso

 
Old May 1st, 2006, 04:21 PM
Friend of Wrox
 
Join Date: May 2006
Posts: 643
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The way I do this is to have a method on a public class (for example, a class whose Instancing is set to Multiuse).
The purpose of this method is to instantiate the form and display it.

For example - this method is on the public class named Class1 in the Dll project (Project2.Class1) - this assumes you have a form named Form1 in the Project2 project:

Public Sub ShowForm()
    Dim f As Form1
    Set f = New Form1
    f.Show vbModal
End Sub

You call it from the Exe like so (assuming you are referencing Project2):

Private Sub Command1_Click()
Dim c As Project2.class1
Set c = New Project2.class1
c.ShowForm
End Sub

I hope that helps




Woody Z http://www.learntoprogramnow.com
 
Old July 18th, 2012, 01:42 PM
Registered User
 
Join Date: May 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

In vb.net I can add a assembly to call the sub from the dll. How can I do this from vb6?
If I use:
Declare Auto Sub ShowTestForm Lib "FormInDll.dll" Alias "ShowTestForm" ()
I get an error like this:
Unable to find an entry point named 'ShowTestForm' in DLL 'FormInDll.dll'.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Dynamic Reference to VB6 DLL webnet .NET Framework 2.0 3 October 4th, 2007 11:41 AM
Use .net dll in VB6? wakeup .NET Framework 2.0 3 March 8th, 2006 05:39 PM
VB6 DLL with Forms ................. Please Help tact_259 VB Components 0 November 16th, 2004 06:41 AM
VB6 DLL With Forms.......Help........Urgent tact_259 Pro VB 6 0 November 16th, 2004 03:27 AM
Creation of ActiveX DLL with VB6 james gold VB Components 2 December 28th, 2003 04:02 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.