Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Control INIT events??
Message
De
20/01/2009 20:22:54
 
 
À
20/01/2009 18:26:52
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
01375744
Message ID:
01375770
Vues:
8
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


>>I am transitioning from FoxPro to C# and I need some advice. In FoxPro every control had an INIT event that you could use to initialize values of a control, etc. Such as adding values to a dropdown box, etc.
>>
>>What event on C# controls can replace the FoxPro INIT Event?
>>
>>Thanks.
>>
>>Bob
>
>Class constructor typically is the counterpart of init.
>Cetin
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform