Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <pre><code> public int childrenCount; //The number of children private void button1_Click(object sender, EventArgs e) { //Adds a child childrenCount++; Panel p = new Panel(); p.Location = new Point(10, (childrenCount - 1) * 200); p.Width = 300; p.Height = 200; p.BorderStyle = BorderStyle.Fixed3D; TextBox tName = new TextBox(); //TextBox for the name tName.Location = new Point(200, 20); tName.Text = "name"; MonthCalendar calendar = new MonthCalendar(); //Calendar to choose the birth date TextBox bloodGroup = new TextBox(); //TextBox for the blood group bloodGroup.Location = new Point(200, 50); bloodGroup.Text = "blood group"; p.Controls.Add(tName); p.Controls.Add(calendar); p.Controls.Add(bloodGroup); this.Controls.Add(p); } private void button2_Click(object sender, EventArgs e) { //Checks the values string message = ""; foreach(Control c in this.Controls) { //loop throught the elements of the form if (c.GetType() == typeof(Panel)) { //check if the control is a Panel //Get the values from the input fields and add it to the message string Panel p = (Panel)c; TextBox tName = (TextBox)(c.Controls[0]); MonthCalendar calendar = (MonthCalendar)(c.Controls[1]); TextBox bloodGroup = (TextBox)(c.Controls[2]); message += tName.Text + ":\n"; message += "birth date: " + calendar.SelectionStart.ToShortDateString() + "\n"; message += "blood group: " + bloodGroup.Text + "\n\n"; } } //show the message string in a MessageBox MessageBox.Show(message); } </code></pre> <p>example:</p> <p>If you add a child called Jack, birth date April the 28. 2013 and blood group A+, the result will be following:</p> <p><strong>Jack:</strong></p> <p><strong>birth date: 28.4.2013</strong></p> <p><strong>blood group: A+</strong></p> <p>(Note, the date string can change if you have an other culture)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload