I have a ToolWindow addin to VS from which I am able to create components
and add them to a form.
However I can't figure out how to add proper class reference.
For instance I place a BindingSource on a form like this:
IComponent dsComp = host.CreateComponent(typeof(BindingSource), "mySource");
(host.RootComponent as Control).Container.Add(dsComp);
Now I would like to hook up the DataSource, and I know in normal code I
would write:
"this.mySource.DataSource = typeof(mynamespace.myClass);"
But for the addin I can write something like this
(dsComp as BindingSource) .DataSource = ???
or should I try to write this code by using the CodeModel. How do I go about
this and how do I find the right spot to add from ?
regards
Martin Stave
Martin Stave - 01 May 2006 12:45 GMT
OK, I think I found the solution myself right away:
> "this.mySource.DataSource = typeof(mynamespace.myClass);"
becomes
(dsComp as BindingSource).DataSource = Type.GetType("mynamespace.myClass");
Martin Stave