Link to home
Start Free TrialLog in
Avatar of Benny Theunis
Benny TheunisFlag for South Africa

asked on

How do I create texboxes programmatically on Pocket PC?

I have an xml file with questions. I want to the system to programmatically create the fields for the items in the xml file. I know this is possible with LINQ.

Info I need to save (also to an xml file):
Personal Details:
Name
Surname
Tel No
Assessment Details:
Section 1
Question 1 - Passed
Question 2 - Failed
Section 2
Question 1 - Passed
Question 2 - Failed

Some xml files may have different amount of questions.

The xml file looks something like this:

<Assessment name="Test Assessment">
  <OperatorInfo>
    <Name />
    <Surname />
    <Tel No />
  </OperatorInfo>
  <AssessmentInfo>
    <QuestionSection name="Section 1" id="0">
      <Question name="Question 1" id="0">Is the sky blue</Question 1>
      <Answer =id"0">
        <Option 1>True</Option 1>
        <Option 2>False</Option 2>
      </Answer>
      <Question name="Question 2" id="1">ALL birds can fly</Question>
        <Answer =id"1">
        <Option 1>True</Option 1>
        <Option 2>False</Option 2>
      </Answer>
    </QuestionSection>
  </AssessmentInfo>
<Assessment>


I started off with a public class:
 public class Operator
    {
        public string operatorName { get; set; }
        public string operatorSurname { get; set; }
        public string operatorTelnum { get; set; }
    }
  public class Assessment
    {
        public string Answer1{ get; set; }
        public string Answer2{ get; set; }
        public string Answer3{ get; set; }
    }

but this will not work, as the amount of sections & questions can differ. How do I go about? Any help?
SOLUTION
Avatar of hjgode
hjgode
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Benny Theunis

ASKER

Thank you for your inputs.

After brushing up on how to create classes and using linq, I now have an idea.

hjgode, I'm currently using the linq method. I have managed to get the Questions as buttons on my form dynamically. The only problem now is to go one level deeper... displaying the elements in my question when I click on the Question button. I have my questions buttons on panel1, and now want to display those question elements on panel2 when I click on the Question button.

I hope I make sense :)
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
By doing some research I have figured it out.