Microsoft Access: String Constants in ActiveX Projects

  • rajdivecha / 104 / Sun, 07 Mar 2010 16:09:00 GMT / Comments (3)
  • Can anybody tell me how could one expose string constants from an ActiveX DLL Projects. The reason I want to do this is that some File name or Table name that are frequently used through the ActiveX DLL should be available to the user (or the client app).

    One way to do this is through Read-Only Property in a Global Multiuse class. But this is not the right way of implementing this. So the only option is to declare the String Constant in one of the Standard Modules and Expose them through the Type Library.

    But the problem is HOW DO I EXPOSE THE STANDARD MODULES FROM AN ACTIVEX DLL OR EXE :confused: :confused: :confused: :confused:

    Only Hard-core programmers would be able to answer this quesion and I am sure one is out there. :)

    There are lots and lots of other such quieries which requires an indepth knowledge of programming in VB, but I want to start with this one.
  • Keywords:

    string, constants, activex, projects, microsoft, access

  • http://www.edevs.com/ms-access-database/23044/«« Last Thread - Next Thread »»
    1. ' Module:
      Public g_strYourVariable As String

      ' User control:
      Public Property Get YourVariable() As String
      YourVariable = g_strYourVariable
      End Property

      Public Property Let YourVariable(ByVal strVar As String)
      g_strYourVariable = strVar
      End Property

      axion_sa | Wed, 05 Dec 2007 13:39:00 GMT |

    2. Go through the posted message thoroughly, it seems you did not understand what's the requirement.

      Explanation of the above problem with an example ....

      Everybody must have used vbCrLf to introduce a line feed in the string to be displayed.

      Where does this vbCrLf come from, obviously from one of the 3 VB standard library. I don't remember at present but it is defined in VBA. Where ever it may it is easy to find through the object browser. Find it and you will notice that it comming from a Standard Module and not from a Class.

      What axion_sa has mentioned is a Public String Property that is available only through the object of that particular class. He is correct if the requirement is that you want a public string property for an object.

      But here what I want is that the string should not be part of any object (i.e., class) but should be avialable Globally like vbCrLf is avialable globally.

      For this one needs a Standard module to be exposed from the ActiveX project. But the Standard module is public only within the ActiveX project and not out side. So how could one expose Standard modules from an ActiveX project. If one could do that he/she can expose a public string constant from the ActiveX project to other client app.

      rajdivecha | Wed, 05 Dec 2007 13:40:00 GMT |

    3. The correct way to do this would be to declare the constant in a Public Module,
      however VB doesn't allow you to create such an animal, leaving you only with the option of creating a Global MultiUse Class Module and use Read-Only properties.
      (as you've already discovered.

      This is simply a limitation of VB, if you really need to create these constants in the correct way,
      use Visual C to create the DLL instead.

      Personally, I think using a Global MultiUse class module is a sufficient work-around as it gives you the functionality you require.

      aaronyoung | Wed, 05 Dec 2007 13:42:00 GMT |

  • Microsoft Access Questions

    • Property Procedures in ActiveX dll

      HELLO EVERYBODY!I am creating DLL that will be configured as COM+ component.In the DLL I have Public...

      By glen711, 2 Comments

    • strange problem

      i know i m doing this thing wrong.. but i m desperate for answers.. if i found no soloution i have ...

      By kirun, 5 Comments

    • Please help with ActiveX exe

      HiI have a program that instansiates an ActiveX exe when it runs. Sometimes, if my program is busy, ...

      By paulb, 7 Comments

    • Property Bag

      hiwhy should we write and read the value of an activeX control property in Property Bag object?is it...

      By vnramkumar, 1 Comments

    • please clarify ...

      can any one tell me how i can acess a server DLL from a Client Application .. suppose i have some DL...

      By chander, 1 Comments