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
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement