Monthly Archives: February 2004

Raising events from dynamic forms through reflection

I have been using reflection for a while to open up forms dynamically and have been past the form properties and form methods hurdle for quite some time. I just had to raise an event from my form that is being loaded dynamically. A quick article by Dino Esposito on VB2theMax made it relatively easy to add this little bit of functionality into my .net quiver. Since I am doing it a bit differently (using a form, rather than a class) here is how I did it. This isn’t my exact code, since I have stripped out some other trickery that I don’t want to get in the way of what I am trying to show here.

Dim asmAssemblyContainingForm As [Assembly] = [Assembly].LoadFrom(“AssemblyContainingForm.DLL“)

Dim TypeToLoad As Type = asmAssemblyContainingForm.GetType(“assemblynamespace.formclassName”)

Dim GenericInstance As Object

GenericInstance = Activator.CreateInstance(TypeToLoad)

Dim f As Form = CType(GenericInstance, Form)

‘//here is the event setup

Dim frmEventUpdateTree As System.Reflection.EventInfo

‘//“TreeSourceChanged“ is the name of the event being raised from my form

frmEventUpdateTree = TypeToLoad.GetEvent(“TreeSourceChanged”)

‘//create a delegate of the same type as my raised event to a local method  named “SetGetNewTreeTrue“

Dim frmDel As [Delegate] = [Delegate].CreateDelegate(frmEventUpdateTree.EventHandlerType, Me, “SetGetNewTreeTrue”)

‘//link up my delegate to the dynamic form

frmEventUpdateTree.AddEventHandler(f, frmDel)

me and Avalon and longhorn

I just had a great idea from reading someone other people’s blogs. I can say this:

I have been spending a lot of time with Avalon and Longhorn since I got my bits at PDC and I just love all of the things I have been able to do with it. It’s really an amazing platform for developing stuff.

Did it work?

About cross-posting weblogs

When I moved away from weblogs.asp.net, I was adamant that I wanted to be able to cross-post back to there. That way I could write whatever the heck I wanted here and then push only .net related stuff over there. I started to get frustrated by having a split personality, by having comments there and not here and finally by realizing that many people were reading my blog there as part of the main feed and not realizing that I am over here. So I haven’t cross-posted in a long long time. (Though I did make two “teaser” posts that pointed to posts that I wrote here.) So I noticed today that on the new blogs.asp.advice feed that Jeff Julian has a blog there. That confuses me. I think that personally I am more of the mind that I want to read what someone says all in one place – I am after the person, not the topic so much. Steve Smith moved over there, too but i think that is going to be his only place for posting. Alex Lowe is there which now adds to his posts since he is also on blogs.msdn.com (aka weblogs.asp.net/MainFeed.aspx?GroupID=2). However Alex clearly states on the new blog that “This blog exists only to highlight interesting discussions on AspAdvice.com. Stay tuned for pointers! “

figured out value of orkut

Brian Dear wrote about an “orkut moment” he had recently, which led me to the realization that in most cases, orkut is a good way to just see what people look like. My account is still active, so I just looked him up (knowing he is a member) and now I know what he looks like. Of course there are obnoxious people like me who post pictures that are only representative of themselves. Here is what I have used for my orkut picture.

I had planned on changing that to a photo of my kayak in the spring.

More on BCL literal definition

Sam Gentile did a presentation at VTdotNET in September that really took the time and care to explain the many terms that define the .NET programming that we do. Although one of the very minor points of his talk, in there he happens to clarify the BCL vs. FCL, which I talked about in this post and discussed a bit with Ian Griffiths from Developmentor (in the comments) as well as Kit George from the BCL Team at MS via email. There really is a lot of misinformation and confusion about these definitions which don’t really impact too many people, but I just somehow got curious.

Here are just some basics that may be totally redundant to some, but may have never been really clear to others.

BCL=Base Class Libraries which are part of the ECMA specification for Common Language Infrastructure (CLI). The CLR is Microsoft’s an implementation of that. Rotor and Mono are other examples of implementations.

In .NET, Microsoft has taken the BCL and added to it all kinds of goodies like WinForms, Data, etc. This is called the FCL (Framework Class Library).

Really – how many gazillions of times have you seen this already?

I am going on and on about this because I have heard many people say “the BCL is ALL of the classes in .NET“.

I even happen to have a copy of Addison Wesley’s Common Language Infrastructure Annotated Standards, but the real definition of the specs is downloadable from the ECMA site (above) if you are curious. I actually have done so, but must now stop the insanity and get back to the programming work I have to do this afternoon!

If you care to understand any of it – where the class libraries come from, what people mean when they say BCL, BCI, ECMA etc etc, I highly recommend checking out Sam’s deck (this page and find the sept 2003 presentation) or even requesting him to come to your (U.S. or Canadian) User Group via INETA. If you view the powerpoints, be sure to turn on your speakers. (heh)