Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 136
  • Last Modified:

Using a VB dll in a VB project on another machine

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
sanfordm
Asked:
sanfordm
  • 8
  • 7
  • 2
  • +1
1 Solution
 
GivenRandyCommented:
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
 
Arthur_WoodCommented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
You may have a reference that is not to the same version on both computer.
0
Technology Partners: 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!

 
sanfordmAuthor Commented:
I know about binary compatability, but at this point I only have one version of the dll.  I have never recompiled at all!
0
 
Arthur_WoodCommented:
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
 
sanfordmAuthor Commented:
AW

Yes, I can run the executable that was created on the source PC just fine, I only have the problem withing VB.
0
 
Éric MoreauSenior .Net ConsultantCommented:
do you know exactly on which line the error occurs?
0
 
sanfordmAuthor Commented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
You have a BIG problem!

When you look at the references, do you have any marked as *MISSING* ?
0
 
sanfordmAuthor Commented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
sanfordmAuthor Commented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
you better use TypeName then TypeOf in your code.
0
 
Éric MoreauSenior .Net ConsultantCommented:
What if you want to use your code in an another application and do not distribute this component?
0
 
sanfordmAuthor Commented:
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
 
sanfordmAuthor Commented:
Thanks for working through it with me!
0
 
Éric MoreauSenior .Net ConsultantCommented:
so is this question over?
0
 
sanfordmAuthor Commented:
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 8
  • 7
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now