?
Solved

Using a VB dll in a VB project on another machine

Posted on 2003-03-28
18
Medium Priority
?
132 Views
Last Modified: 2010-05-01
I have a set of dll files developed on one machine.  I copied them to the target machine and register them and can then run an executable that references them without any problems.  However, running the application through the visual basic IDE which references the same dlls does not run correctly.  I get the error  object does not support property or method.  I have no idea why this is happening.  Any suggestions?
0
Comment
Question by:sanfordm
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 7
  • 2
  • +1
18 Comments
 
LVL 9

Expert Comment

by:GivenRandy
ID: 8226426
You probably have to deselect the reference in the project references, then re-browse for it by selecting the browse button (to the right) and re-find it and select OK. It should resync with the newer version.
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 8226542
welcome to what is known as 'DLL Hell'.  When you created the DLL, did you set Binary Compatability ON?

When a DLL is created, VB generates a 'signature' for the DLL, which is the GUID that is actually stored in the registry when the DLL is registered.  If NO compatability is set, then EVERY TIME a New version of the DLL is BUilt, that GIUD is completely DIFFERENT, which means that what is in the registry DOES NOT correspond what is in the DLL, and the code "can't find" the DLL.

If Project Compatability is set on, then the GUID is only changed if the "INTERFACE" supported by the DLL changes - the INTERFACE being the PUBLIC exposed sigantures of all of the classes and methods exposed by the DLL - the signature of a class being the EXACT list of Methods and properties).  But if the signature of ANYTHING in the DLL changes, then a NEW GUID is generated, and once again, the code "can't find" the DLL.

With Binary Compatability set ON, you provide a REFERENCE DLL, which the current version MUST ABSOLUTELY MATCH, or else an error message is generated when you attempt to BUILD a new version of the DLL, to the effect that the New code DIFFERS from the OLD code.  If THAT error does NOT occur, then the NEW DLL is built using the EXISTING GUID, and the running code CAN find the New version of the DLL.

Basically, BINARY Compatability enforces an IMPLIED contract between the DLL and the users of the DLL, which says that the DLL and ALL of its components, will ALWAYS APPEAR the same from the outside (this does not mean that you can't change HOW something is done inside a class, just how the class presents itself to the outside world).

AW
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8226574
You may have a reference that is not to the same version on both computer.
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:sanfordm
ID: 8226600
I know about binary compatability, but at this point I only have one version of the dll.  I have never recompiled at all!
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 8226651
and the DLL was successfully installed on the other PC, and then the necessary reference added to the the Project on the other PC?

AW
0
 

Author Comment

by:sanfordm
ID: 8226673
AW

Yes, I can run the executable that was created on the source PC just fine, I only have the problem withing VB.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8226714
do you know exactly on which line the error occurs?
0
 

Author Comment

by:sanfordm
ID: 8227326
I tracked it down.  Ready for this, The line that fails is

TempString = "True"

This line is inside of a sub
and the declare for TempStrig is also in that sub, which is simply.

Dim TempString As String
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8227366
You have a BIG problem!

When you look at the references, do you have any marked as *MISSING* ?
0
 

Author Comment

by:sanfordm
ID: 8227448
Sorry, that was not it.  The code that actual fails is this.

Private Sub Evaluate_Indicator(tempControl As Control)

If TypeOf tempControl Is SSCommand Then
    tempControl.BackColor = &HFFFF&
    Exit Sub
Else
    BKColor = tempControl.LightOnColor    'This line fails
End If

For some reason it doesn't recognize the tempControl to be a SSCommand button and it goes to the else part and then gives the error because an SSCommand doesn't have a LightOnColor property.

I was able to process the tag, so I know that I have the proper control which is an SSCommand.

But again, why would the exe work and not VB, so I am not so sure that the code is the problem.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8227476
What does TempControl contains when it crash?

You may use this:

Else
  On error Resume Next
   BKColor = tempControl.LightOnColor    'This line fails
End If
0
 

Author Comment

by:sanfordm
ID: 8227646
I did a typeName on the TempControl and it returned "SSCommand".  So that is really weird that the typeof check failed.  I also checked to make sure that the SSCommand control was the same on both machines (and it is).  SSCommand is a third part push button.
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 300 total points
ID: 8227667
you better use TypeName then TypeOf in your code.
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8227672
What if you want to use your code in an another application and do not distribute this component?
0
 

Author Comment

by:sanfordm
ID: 8227722
Yea, thats what I did (switch to typename).  I have another wierd one too.  I image its a very similar problem.  I'll have to check.  Thanks.

That component is always distributed with out apps (it is always used).
0
 

Author Comment

by:sanfordm
ID: 8227734
Thanks for working through it with me!
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 8227736
so is this question over?
0
 

Author Comment

by:sanfordm
ID: 8227767
Yea, unless you know why typeof didn't work.  Its solved now that I am using typename.  I gave you the points.  If the other problem is different, I may start a new question.
Thanks again
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses
Course of the Month8 days, 16 hours left to enroll

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question