StrataFrame Forum

Getting an object reference to a component at runtime

http://forum.strataframe.net/Topic27297.aspx

By Charles R Hankey - 6/2/2010

I'm in over my head again. This looks like something McGuffey would geek out on.



I have a groupbox control - my subclass of SF groupbox.



The goal is to put code in the Leave that will find a tabordercontroller on the form and set focus to the nextvisiblecontrol. (necessary as when on a tabpage is doesn't seem to be able to find it on its own)



The components collection is not exposed and as far as I can tell the TOC is not a in the controls collection.



the me.components.components is empty from within the form.



I am okay with always naming the TabOrdercontroller TOController and assuming only one on a form.



But I want to be able to say "If the parent form of this groupbox uses a tabordercontroller call its method to setfocus to the next visible control"



Thoughts?
By Greg McGuffey - 6/2/2010

I think my other post might get you there. I'd keep it simple and just add a TabController property to the groupbox. Not only will you get this done faster, it will run faster (no mucking through collections to try and find the controller...its already set). Also, if the TabController ends up not playing nicely, you could always just add a property for the next control, but have its type be System.Windows.Forms.Control, rather than String.