Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Control INIT events??
Message
 
To
20/01/2009 20:22:54
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
01375744
Message ID:
01375787
Views:
7
>You are right, but I guess I didn't phrase the question properly.
>
>In FoxPro, the INIT event of the form runs after all the controls on the form have been initialized, so you can refer to them in the form's INIT event. But in C# the Controls collection doesn't seem to be available in the constructor. At least in the constructor of a Panel that I have created to hold a bunch of controls.
>
>I need to loop through the controls after they are initialized so that I can set the Bindings on certain objects at runtime. I.e., the TextBoxes, etc.
>
>I used this code to try to accomplish this: (The DataViewPanel is a Panel that contains all of my data controls) I'm using a panel instead of a form so that I can use an expandable splitter. And so I can bring in and out of the main form different panels as they are needed.
>
>public DataViewPanel() //Constructor
>{
> InitializeComponent();
> BindControls();
>}
>
>private void BindControls()
>{
> foreach (Control ctl in this.Controls)
> { //Do something
> }
>}
>
>The BindContols method doesn't see any Controls in the Controls Collection. Can you tell me where I'm going wrong?
>
>Thanks.
>
>bob

The code posted should work. What type of error do you get?
You can also try to use the Load event. Load firest after the constructor
Semper ubi sub ubi.
Previous
Reply
Map
View

Click here to load this message in the networking platform