By Greg McGuffey - 11/10/2006
I'm new to .Net and am having fun learning it, especially with SF doing lots of the heavy lifting.
I just created a component, using the Component Class template*. I added my code (copied from a normal class that was working). I build the app...no component in toolbox.
So, I must be missing something, need to add an attribute, implement some method. Any ideas?
* OK, extactly what I did
1. Added a new Item, using Component Class
2. Inside the class definition, copied my code form another class into it. This included several overloads for the constructor, 4 properties, 1 method, some private procedures, the fields to hold the property data and a private internal class.
3. Had to delete my default constructor, because the template provided one form me
4. Build project, no compile errors, but also no component in toolbox.
|
By Trent L. Taylor - 11/10/2006
More than likely you overwrote something in the component when you pasted in your code. If you just create a component and do not change anything at all...and build. Does it show up?
|
By Greg McGuffey - 11/10/2006
Hmmm....sure does (that is i create a new component, then built, without touching code and it was added)
Probably has to do with my constructors. I'm gonna check that..by right back
|
By Trent L. Taylor - 11/10/2006
More than likely you are correct...it is your constructors.
|
By Greg McGuffey - 11/10/2006
hmm...Well, I copied the code from my original (non-component toolbox working) component to the new test one. I did it a bit at a time to see were it would fail and it...didn't fail. I copied all of the code over and it works
The only thing I can think of is that when I did the first time, I built it with a duplicate default constructor, somehow it messed with the design code.
|
By Greg McGuffey - 11/10/2006
It's the name of the component. I deleted the first one, renamed my test one to the original name...no show in toolbox. Rename that same component by appending a 1 to it, viola, its in the toolbox.
The name is NavByPanelManager. When named this, it doesn't show up in the toolbox. Rename it to NavByPanelManager1 and it does. What's up with that? Any ideas?
|
By Greg McGuffey - 11/10/2006
I renamed the thing and now I'm chugging away. So, the next problem....
I need to fire off an initialize method of the component when the form loads. I know this can be done, you all do it with many of your controls, but how? How do I tie into the form load event within the component, so the caller just sets the properties and it works? (I'm thinking of list population and the populateonformload property, which when set to FormLoad just loads the list automagically).
Thanks!
|
By Trent L. Taylor - 11/11/2006
This isn't a quick little post topic Basically you need to do two things...implement the ISynchronizeInvoke interface on your control and have it capture the parent control (form) when dropped on the form. You will then need to take that interface and handle the load event of the form in the constructor of your component...don't forget remove the handlers when the control is disposing.
|
By Greg McGuffey - 11/13/2006
Okey dokey, I'll get right on that
Actually, this is bit over my head at the moment. I'll have to come back to this, though it seems you gave plenty of info to get started when the time is right. For now, I'll live with the single line of code I need to init the component
Thanks!
|
|