Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Beginning VB 6
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning 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 November 22nd, 2004, 03:20 PM
Registered User
 
Join Date: Nov 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Populating a label Using a ActiveX DLL

I am trying to use a activeX DLL to populate a label with text, but i am unable to get it to work. The DLL is referenced in the project. Below is the code. Any help would be great.

Dll Code

Public Sub Get_Text ()
   form1.label1.Caption = " Hello World"
End Sub

Form Code

Option Explict

Dim a As testtext 'testtext is the class in the activex dll

Private Sub Form_Load ()
   Set a = New testtext
   Call a.Get_Text
End Sub


 
Old November 22nd, 2004, 03:30 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

well, is form1 a form in the DLL propject or in the main project?
Remember that only forms belonging to the same project can be accessed.

Marco
 
Old November 22nd, 2004, 04:28 PM
Registered User
 
Join Date: Nov 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The form is part of the main program. I found that in debugging, you can only access forms within a project. How can I make this work?
I need to try and keep them separate, for updating reasons. I want to be able to make changes only to the DLL, and the main program retrieve the information.

I am creating a program that needs to be updated without having to re-compile the entire program.
Thanks


 
Old November 22nd, 2004, 05:52 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you are making it the wrong way.
The dll should be a gui-less component, that reads data (from wherever it is, database, file, internet) and exposes it via properties. The dll should be completeley ignorant of any user interface, so in this way the same dll can be used by more than one app. The main app creates an instance of the dll, and populate its form[s] with the data collected in the dll. There is no reason to recompile anything as long as the data is read on run time:

Option Explict
Dim a As testtext 'testtext is the class in the activex dll
Private Sub Form_Load ()
   Set a = New testtext
   Me.Caption = a.GetFormCaption
End Sub

Marco
 
Old November 22nd, 2004, 06:33 PM
Registered User
 
Join Date: Nov 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Ill give that a try, and go from there. Thanks






Similar Threads
Thread Thread Starter Forum Replies Last Post
Advantages /Disadvantages of ActiveX DLL & ActiveX priyank Beginning VB 6 6 February 19th, 2007 11:34 AM
ActiveX DLL Joann Beginning VB 6 6 January 25th, 2007 08:50 PM
creating an activex dll amc VB Components 7 June 25th, 2004 05:10 PM
ActiveX Exe and Dll Vasudevan VB How-To 1 September 26th, 2003 07:48 AM
Distribution of ActiveX DLL james gold Pro VB 6 6 September 10th, 2003 11:13 AM





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