X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
> How To Reference And Call A Function In A Vb.net Class    
post Mar 3 2019, 08:28 PM

Posts: 150
Joined: 16-October 12

A function exists in VB.NET (actually, Microsoft.VisualBasic.Conversion.CTypeDynamic(object, System.Type)) that does not exist in VB6. I'd like to use this VB.net function in an Access 2007 project.

So, I just installed Visual Studio 2019 to get the DLL (C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Microsoft.VisualBasic.dll) (similar paths for other .NETFramework versions).

The problem is, (i) the VB.NET type library isn't obvious from the Access 2007 Visual Basic Editor (Tools > References); and further(ii) the Editor won't allow one to reference this DLL, and no Type Library file (*.tlb) or Object Library file (*.olb) seems to exist for the DLL.

I'd be grateful for any thoughts about how I can get use of this function. I'm guessing this is either a matter of getting the editor to recognize something, or maybe some kind of late-binding approach involving GetObject(), but a few hours into it, no solution is obvious.

My purpose, BTW, is to set an object variable using a string variable. This is leading to type mismatch errors, so I thought I'd just change the type using

Dim c As String
Dim d As Control
c = [expression]
d = CType(c, Control)

but I have to be able to call the function.

Thanks in advance for any thoughts.
Go to the top of the page
Start new topic
post Mar 4 2019, 07:59 PM

Posts: 150
Joined: 16-October 12

Understood. My error was in equating the string variable and its contents in this context.
Go to the top of the page
post Mar 4 2019, 08:05 PM

UtterAccess VIP
Posts: 2,819
Joined: 12-April 07
From: Edmonton, Alberta Canada


And don't shy away in the future asking as to how one can call some .net code (vb.net). I do this rather often. So while that part of your inquiry did not apply, it still often a great idea and allows you to extend Access applications in a great way.

Good luck - wheels up!

Albert D. Kallal (Access MVP 2003-2017)
Edmonton, Alberta Canada
Go to the top of the page

Posts in this topic

Custom Search

RSSSearch   Top   Lo-Fi    18th July 2019 - 12:17 PM