Re: Programaticly call a method from a different object?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



What's wrong with Visitor or Chain of Responsibility? You can set them up
at runtime.

--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"schneider" <eschneider@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:eYUV0o$QHHA.4252@xxxxxxxxxxxxxxxxxxxxxxx
No, I know how to do a plug-in design, and already using it.

Trying to wire two methods together during runtime, similar to addhandler
but method to be called is discovered by reflection.

Currently using the Ben pattern, I just thought I might me missing cleaner
language feature...

Schneider


"Nick Malik [Microsoft]" <nickmalik@xxxxxxxxxxxxxxxxxx> wrote in message
news:0_2dnajF7cO_pyPYnZ2dnUVZ_uKknZ2d@xxxxxxxxxxxxxx
What is the objective? Do you want to be able to develop a plug-in for
your code, after the system is released, and have your system recognize
it?

If so, that's covered loosly by traditional Design Patterns. I would
recommend you investigate the Gang of Four Design Patterns, especially
Strategy, Visitor, and Chain of Responsibility. (good reference on GoF
patterns: http://home.earthlink.net/~huston2/dp/patterns.html )

Once you understand the design patterns that lead to frameworks, go ahead
and dive into a light framwork like Spring.Net. Here's an article on
Dependency Injection in .Net:
http://msdn.microsoft.com/msdnmag/issues/05/09/DesignPatterns/default.aspx


--
--- Nick Malik [Microsoft]
MCSD, CFPS, Certified Scrummaster
http://blogs.msdn.com/nickmalik

Disclaimer: Opinions expressed in this forum are my own, and not
representative of my employer.
I do not answer questions on behalf of my employer. I'm just a
programmer helping programmers.
--
"schneider" <eschneider@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:%230j09yVQHHA.488@xxxxxxxxxxxxxxxxxxxxxxx
I'm looking for a way to programaticly call a method from a different
object and associate the two objects at runtime.

Example: Object A exist and is unknow, I want object B to be able to
call a method on object A whenever needed.

Like addhandler but I don't know what the method is and must discover it
through reflection.

Maybe something like this:

Public Sub attach(ByVal valueA As Object)

Dim meth() As MethodInfo = value.GetType.GetMethods

Dim btnB As Button = New Button

Dim mitem As MethodInfo = meth(0) 'find the method I want somehow

AddHandler btnB.Click, mitem.[Selected_Method] '???

End Sub

Any ideas would be great.

Thanks,

Schneider










.



Relevant Pages

  • Re: Too funny MS ad in Visual Studio Magazine...
    ... I do not answer questions on behalf of my employer. ... >> Disclaimer: Opinions expressed in this forum are my own, ... >> programmer helping programmers. ...
    (microsoft.public.dotnet.general)
  • Re: How to get LastAccessTime of a file without modifying it?
    ... I do not answer questions on behalf of my employer. ... "Yavuz Bogazci" wrote in message ... Opinions expressed in this forum are my own, ... >> programmer helping programmers. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: what is the best way to read text file
    ... Disclaimer: Opinions expressed in this forum are my own, and not representative of my employer. ... I'm just a programmer helping programmers. ...
    (microsoft.public.dotnet.framework)
  • Re: working with large files
    ... Disclaimer: Opinions expressed in this forum are my own, ... I do not answer questions on behalf of my employer. ... programmer helping programmers. ...
    (microsoft.public.dotnet.general)
  • Re: Convert a string to bool
    ... one person's trivial task is another person's challenge. ... > know design patterns, the OP may benefit from reading this book in its ... > I do not answer questions on behalf of my employer. ... > programmer helping programmers. ...
    (microsoft.public.dotnet.languages.csharp)