?
Solved

Can you determine a procedure's address from its name?

Posted on 2004-09-27
4
Medium Priority
?
213 Views
Last Modified: 2010-04-23
I am interested in using a method's name (ie MyFunc) to find its address. I know you can use CallByName to actually call the function, but I just want to get its address. I have a delegate and I want to assign it the AddressOf "MyFunc".
0
Comment
Question by:BASESLydia
[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
  • 2
4 Comments
 
LVL 10

Accepted Solution

by:
123654789987 earned 375 total points
ID: 12159664
u can use the GetAssemblyByName method

Imports System
Imports System.Reflection
Imports System.Text.RegularExpressions
Imports Microsoft.VisualBasic

Public Class AssemblyName_GetAssemblyName
   
   Public Shared Sub Main()
     

      ' Get the type of 'System.Object'.
      Dim myType As Type = GetType(System.Object)
     
      ' Get the path of 'System.dll'.
      Dim system As String = Regex.Replace(myType.Assembly.CodeBase, "mscorlib.dll", "System.dll")
      system = Regex.Replace(system, "file:///", "")
     
      ' Get the assembly information and display to the console.
      Dim myAssemblyName As AssemblyName = AssemblyName.GetAssemblyName(system)
      Console.WriteLine(ControlChars.Cr + "Displaying the assembly information of 'System.dll'" + ControlChars.Cr)
      Console.WriteLine(myAssemblyName.ToString())
   End Sub 'Main
End Class 'AssemblyName_GetAssemblyName

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12170767
What's wrong with AddressOf?

Bob
0
 
LVL 1

Author Comment

by:BASESLydia
ID: 12170815
Unless I am using it wrong, AddressOf requires the function name be typed at runtime, you cannot use a string as a parameter. I would like to load the string name from a database and get the address from it at a runtime.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 12170838
Aaah, yes, that one again.  Good luck!

Bob
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

777 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