|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Reading dll-Functions and execute themI am trying to load an assembly (dll) an this works fine for me with: Dim SampleAssembly As [Assembly] SampleAssembly = [Assembly].LoadFrom("c:\clsHali.dll") But now I like to read all public functions I have created and can't make this work I have to public functions in it called hali1 and hali2... I have tried it with getmethods, gettypes and whatever but never get the results I needed... How can I read all public functions of this assembly? The second question is: How can I execute the function or whatever if I found the function (hali1 or hali2) I needed? Thanks alot for every help! Nijazi Halimaji You first need to get the types ussing Assembly.GetExportedTypes (assuming
that your functions are in public types) and once you have a type you use: objType.GetMethods or some variant. Once you have a MethodInfo, to execute it you use: objMethodInfo.Invoke(objectInstance, ....) If you still have problems, post the minimal code to reproduce it in order to us to take a look. -- Show quoteHide quoteBest regards, Carlos J. Quintero MZ-Tools: Productivity add-ins for Visual Studio You can code, design and document much faster: http://www.mztools.com "Halimaji Nijazi" <t***@hotmail.com> escribió en el mensaje news:OYYr7OoGGHA.2000@TK2MSFTNGP15.phx.gbl... > Hi everybody > > I am trying to load an assembly (dll) an this works fine for me with: > > Dim SampleAssembly As [Assembly] > > SampleAssembly = [Assembly].LoadFrom("c:\clsHali.dll") > > > But now I like to read all public functions I have created and can't make > this work I have to public functions in it called hali1 and hali2... I > have tried it with getmethods, gettypes and whatever but never get the > results I needed... > > How can I read all public functions of this assembly? > > The second question is: > How can I execute the function or whatever if I found the function (hali1 > or hali2) I needed? > > Thanks alot for every help! > > Nijazi Halimaji > > Thanks for the tips... I did it!
regards Nijazi Halimaji Show quoteHide quote "Carlos J. Quintero [VB MVP]" <carlosq@NOSPAMsogecable.com> schrieb im Newsbeitrag news:%23JRfRNrGGHA.3176@TK2MSFTNGP12.phx.gbl... > You first need to get the types ussing Assembly.GetExportedTypes (assuming > that your functions are in public types) and once you have a type you use: > > objType.GetMethods or some variant. > > Once you have a MethodInfo, to execute it you use: > > objMethodInfo.Invoke(objectInstance, ....) > > If you still have problems, post the minimal code to reproduce it in order > to us to take a look. > > -- > > Best regards, > > Carlos J. Quintero > > MZ-Tools: Productivity add-ins for Visual Studio > You can code, design and document much faster: > http://www.mztools.com > > > "Halimaji Nijazi" <t***@hotmail.com> escribió en el mensaje > news:OYYr7OoGGHA.2000@TK2MSFTNGP15.phx.gbl... >> Hi everybody >> >> I am trying to load an assembly (dll) an this works fine for me with: >> >> Dim SampleAssembly As [Assembly] >> >> SampleAssembly = [Assembly].LoadFrom("c:\clsHali.dll") >> >> >> But now I like to read all public functions I have created and can't make >> this work I have to public functions in it called hali1 and hali2... I >> have tried it with getmethods, gettypes and whatever but never get the >> results I needed... >> >> How can I read all public functions of this assembly? >> >> The second question is: >> How can I execute the function or whatever if I found the function (hali1 >> or hali2) I needed? >> >> Thanks alot for every help! >> >> Nijazi Halimaji >> >> > >
VB for .NET Recommended?
how to prevent multiple instances of 2nd form? aggregation simple .net code column subtotals in a datagrid reuse query results for multiple object populations? (and dynamic variable names?) Checking a string for filename compliance Wordwrap in VB.Net listbox? Crystal Report parameter dialog box ShouldSerialize problem in inherited control OFF TOPIC: Famous failed IT projects |
|||||||||||||||||||||||