I need to read data from the GUI screen. Which has for example, 1. Name 2. Sub-Name 3. Favorite Numbers.
The "Name", "Sub-Name" and "Favorite Numbers are text boxes.I would create more Names by appending the details to the xml document. is there any class implementation for storing the values from GUI before writing to the XML. In my case by using the class SubName like
Class SubName
{
public SubName
{
Num = new List<int>();
}
public string Sub-Name{get;set;}
public list<int> Num{get;set;}
}
</int></int>
i tried to store the "Num" values in the List. I need to validate all of the Sub-Names to be made ready to write to XML, as there is certain rule that limits the total sum of "Num" values present in all of Sub-Names.
so, by having
<pre lang="c#">SubName[] subs = new SubName[10]
and assign the values that i read from the GUI screen to the class values by,
subs[0] = new SubName();
subs[0].Sub-Name = txtboxSubName.Text
subs[0].Num = listNum
where, listNum is of type
<pre lang="c#">List<int></int>
.
My problem is while creating the XML tags, the Sub-Name is properly written but the Num values are not present. Is there any solution. Or else is there any better method than this. The expected XML tags are presented below...
<Header>
<names>
<name>TEST</name><sub>
<sub-name>XYZ</sub-name>
<num>1</num><num>2</num><num>3</num><num>4</num><num>5</num><num>6</num><num>7</num>
<sub-name>XYZ</sub-name>
<num>1</num><num>2</num><num>3</num><num>4</num><num>5</num><num>6</num><num>7</num>
<sub-name>XYZ</sub-name>
<num>1</num><num>2</num><num>3</num><num>4</num><num>5</num><num>6</num><num>7</num>
<sub-name>XYZ</sub-name>
<num>1</num><num>2</num><num>3</num><num>4</num><num>5</num><num>6</num><num>7</num>
</sub></names>
<names>
<name>ROTW</name><sub>
<sub-name>XYZ</sub-name>
<num>1</num><num>2</num><num>3</num><num>4</num><num>5</num><num>6</num><num>7</num>
<sub-name>XYZ</sub-name>
<num>1</num><num>2</num><num>3</num><num>4</num><num>5</num><num>6</num><num>7</num>
<sub-name>XYZ</sub-name>
<num>1</num><num>2</num><num>3</num><num>4</num><num>5</num><num>6</num><num>7</num>
<sub-name>XYZ</sub-name>
<num>1</num><num>2</num><num>3</num><num>4</num><num>5</num><num>6</num><num>7</num>
</sub></names></Header>