mardi 2 juin 2015

Holding information in hashtables or arrays then outputting

I am developing a program in and am not sure what to do about this problem.

In my program, I have a large amount of checkboxes (Yes and No) and when No is selected, a textbox appears prompting the user to write a comment, example below:

private void checkBox48_CheckedChanged(object sender, EventArgs e)
  {
      if (checkBox48.Checked == true)
      {
          // Create an instance of the dialog
          frmInputBox input = new frmInputBox();
          // Show the dialog modally, testing the result.
          // If the user cancelled, skip past this block.
          if (input.ShowDialog() == DialogResult.OK)
          {
              // The user clicked OK or pressed Return Key
              // so display their input in this form.

              problems = problems + "23. Check Outlet Drainage : " + input.txtInput.Text + Environment.NewLine;
              this.txtProblems5.Text = problems;
              txtProblems5.Visible = true;
          }

          // Check to see if the dialog is still hanging around
          // and, if so, get rid of it.
          if (input != null)
          {
              input.Dispose();
          }
      }
  }

However, temporarily I have the user input just writing to a String called problems. I would like to hold each of these values in separate places.

Would hash tables or an array be suitable? (For example txtInput.Text = Problems[40])




Aucun commentaire:

Enregistrer un commentaire