.Net component question


Author
Message
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
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.
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
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?
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
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 BigGrin
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
More than likely you are correct...it is your constructors. 
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
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 Crazy



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.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Angry



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?
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
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!
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
This isn't a quick little post topic Smile  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.
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.4K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
Okey dokey, I'll get right on that Hehe



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 BigGrin



Thanks!
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search