G
Gary Morris
Hello all,
This is my situation. I'm reading an XML file with a variable number of
nodes.
So far, all of the code has been reasonably easy, but now I'm up against a
wall trying to figure out the best way to proceed.
Upon reading in a valid node, I'm wanting to add a tabpage to a tab control
based on the name value of the node. Since all of the tabpages will have the
same child controls, I customized the tabpage and made a class that uses
tabpage as the base class and put all of the controls I need on it. This
works
great. Everytime I need a new page, I just instantiate a new instance and
add
it to the tab control. The problem now is naming the pages. I thought of an
array, which would be nice, but there won't always be the same number of
valid nodes. Not only that, but the user may want to add more nodes while
working with the files. When a new node is created, it gets it's own
tabpage,
so a fixed array is not a good option. My idea was to just name each tabpage
with the name of the node, but I am having a hard time with that. I did read
up on reflection, and that might be the best way to go, I just don't know
how
to do it. If anyone can help with ideas or other options for doing this, I'd
be
all ears. Alternatively, if someone knows a good article or an example of
how
this is done, please point me to it.
What I need to be able to do is something like:
XmlTabPage <Node.Name> = new XmlTabPage();
where <Node.Name> is the Node's actual text name.
I will be using the Tag property to index and refer to the tabpages, so the
only
time I need to do this is on creation.
Thanks.
This is my situation. I'm reading an XML file with a variable number of
nodes.
So far, all of the code has been reasonably easy, but now I'm up against a
wall trying to figure out the best way to proceed.
Upon reading in a valid node, I'm wanting to add a tabpage to a tab control
based on the name value of the node. Since all of the tabpages will have the
same child controls, I customized the tabpage and made a class that uses
tabpage as the base class and put all of the controls I need on it. This
works
great. Everytime I need a new page, I just instantiate a new instance and
add
it to the tab control. The problem now is naming the pages. I thought of an
array, which would be nice, but there won't always be the same number of
valid nodes. Not only that, but the user may want to add more nodes while
working with the files. When a new node is created, it gets it's own
tabpage,
so a fixed array is not a good option. My idea was to just name each tabpage
with the name of the node, but I am having a hard time with that. I did read
up on reflection, and that might be the best way to go, I just don't know
how
to do it. If anyone can help with ideas or other options for doing this, I'd
be
all ears. Alternatively, if someone knows a good article or an example of
how
this is done, please point me to it.
What I need to be able to do is something like:
XmlTabPage <Node.Name> = new XmlTabPage();
where <Node.Name> is the Node's actual text name.
I will be using the Tag property to index and refer to the tabpages, so the
only
time I need to do this is on creation.
Thanks.