Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / May 2006

Tip: Looking for answers? Try searching our database.

Adding components from ToolWindow how

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Martin Stave - 01 May 2006 12:25 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.