Re: Initializing form (dialog)
- From: DH <I.dont.need@xxxxxxxxx>
- Date: Wed, 17 Dec 2008 14:42:48 -0800
Alex wrote:
DH, thanks for the reply. But the example I gave is very simple, inAlex,
reality I have much more controls. To have a constructor with twenty
parameters seems a little bit odd to me. So there is nothing like
OnInitDialog() indeed?
Thanks again,
Alex
On Dec 17, 4:44 pm, DH <I.dont.n...@xxxxxxxxx> wrote:Alex wrote:Hello everybody,Alex,
I'm just starting C#. I'm working on forms based application. The
parent form has some buttons. If I click the button, some child form
must pop-up. My question is - is there in C# something analogous to
OnInitDialog from C++? So I'm able to initialize controls in the
child form based on the info from the parent?
I have:
private void btSomeButton_Click(object sender, EventArgs e)
{
SomeChildDlg dlg = new SomeChildDlg();
dlg.m_strValueForControl1 = "aaaaaa";
dlg.m_strValueForControl2 = "xxxxxx";
if (dlg.ShowDialog() == DialogResult.OK)
......................................................
..............................
But how at the very beginning can I populate controls in my
SomeChildDlg form (put string "aaaaaa" in one text box on child form
and assing "xxxxxx" to another text box) ? Do I have to call
someother function in between constructor and dlg.ShowDialog()?
Thanks,
Alex
If you are just going to be populating controls with some value you
could create a constructor that takes them as a parameter of some sort.
DH- Hide quoted text -
- Show quoted text -
I havnt done C++ programming like this. But you could pass it as a class of some type to the constructor i would imagine and just enumerate the properties.
I'm doing something similar but my requirements are very tight and the data i need is written to a XML each time and I just pass it the XML data.
.
- References:
- Initializing form (dialog)
- From: Alex
- Re: Initializing form (dialog)
- From: DH
- Re: Initializing form (dialog)
- From: Alex
- Initializing form (dialog)
- Prev by Date: Re: Suggestion for C# language: Modification to the "new" keyword - Allow type inference in C# to use the left-hand side of the assignment
- Next by Date: Re: Referencing object properties
- Previous by thread: Re: Initializing form (dialog)
- Next by thread: Re: Initializing form (dialog)
- Index(es):