Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7632113
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T06:32:13+00:00 2026-05-31T06:32:13+00:00

I have seen this done in C#, such as here although, I cannot seem

  • 0

I have seen this done in C#, such as here although, I cannot seem to figure out how to do this in VB.NET. For some background, I have created a custom ComboBox control as a .dll, and I need to implement it in another .dll(ArcMap Component).

Unfortunately, ArcMap does not allow for “third-party” DLL’s to be loaded along with the component, because there is no option to reference any third-party assemblies for your add-in.

If someone could point me in the right direction, it would be more than appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T06:32:15+00:00Added an answer on May 31, 2026 at 6:32 am

    We use this technique in VB.NET in Visual Studio 2008…

    First, the project needs to know to include the “other” dll as an Embedded Resource. In the Solution Explorer, add the dll as a file to your project (not as a Reference). Then, open the Properties for the file and set the Build Action to “Embedded Resource.” It is recommended that you create a local copy of the dll file in the structure of your project rather than linking to some other location. Once the project includes the dll file, you can then add the reference to that copy of the dll so that you can use its contents at design-time.

    That ensures that the “other” dll is included in your compiled dll, but it doesn’t make it automatically load when needed. That’s where the following code comes in:

    Public Module Core
    
    Private _initialized As Boolean
    
    Public Sub EnsureInitialized()
      If Not _initialized Then
        AddHandler AppDomain.CurrentDomain.AssemblyResolve, AddressOf AssemblyResolve
        _initialized = True
      End If
    End Sub
    
    Private Function AssemblyResolve(ByVal sender As Object, ByVal e As ResolveEventArgs) As Assembly
      Dim resourceFullName As String = String.Format("[CONTAINER ASSEMBLY].{0}.dll", e.Name.Split(","c)(0))
      Dim thisAssembly As Assembly = Assembly.GetExecutingAssembly()
      Using resource As Stream = thisAssembly.GetManifestResourceStream(resourceFullName)
        If resource IsNot Nothing Then Return Assembly.Load(ToBytes(resource))
        Return Nothing
      End Using
    End Function
    
    Private Function ToBytes(ByVal instance As Stream) As Byte()
        Dim capacity As Integer = If(instance.CanSeek, Convert.ToInt32(instance.Length), 0)
    
        Using result As New MemoryStream(capacity)
            Dim readLength As Integer
            Dim buffer(4096) As Byte
    
            Do
                readLength = instance.Read(buffer, 0, buffer.Length)
                result.Write(buffer, 0, readLength)
            Loop While readLength > 0
    
            Return result.ToArray()
        End Using
    End Function
    
    End Module
    

    Place this Module somewhere in your project and be sure to call the EnsureInitialized method to attach the AssemblyResolve handler before calling any other code in your dll.

    NOTE: You’ll need to replace [CONTAINER ASSEMBLY] with the name of your dll.

    Also note that the above code is a stripped-down version of what we actually use because ours includes log4net logging messages at strategic places. The logging messages aren’t necessary for the true functionality, so I removed them for brevity and clarity.

    The major caveat to this approach is that the AssemblyResolve handler has to be attached manually. Even if you can’t set things up so that EnsureInitialized is called only once during the initialization of the consuming code, you can call EnsureInitialized within any of your own modules that require the “other” dll for execution. This makes the code a little more delicate because you have to remember to make that initialization call, but it does allow you to sleep at night knowing that the dll will be available when you need it.

    In my experience, some “other” dlls don’t play well when they are provided as embedded resources, so you might need to play around a bit to get things working.

    Final Note: I’ve never used ArcMap Component, so Your Mileage May Vary!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know this can be done and i have seen it done using some
How do I preview a url using ajax? I have seen this done with
for (;;) { //Something to be done repeatedly } I have seen this sort
Okay i've seen this done somewhere before where you have a function that takes
I have seen this done when moving a table, but it uses the entire
I have seen this problem arise in many different circumstances and would like to
I have seen this link: Implementing Mutual Exclusion in JavaScript . On the other
I have seen this macro defined before but never really knew its purpose. Can
I have seen this in a lot of XML comments for classes in the
I have seen this syntax in MSDN: yield break , but I don't know

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.