a ComboBox, TextBox and XML file

jemico

Member
Joined
May 16, 2005
Messages
6
Please help me on this.. (beginners headache)

im working on a c#.net project and getting a hard time figuring this out.

My mainForm has 1 comboBox and 1 Textbox, when the mainForm loads, the items on the comboBox is added programmatically from XML file particularly from all the name tags (see XML file below), i want to display the content of the description tag to the textbox, for example if in the combobox johnny is selected, the description for johnny will display on textbox, same for mary.

Hope you can help me with sample codes. Thank you..

my XML file is just like this:

<?xml version="1.0" ?>
<categories>
<category>
<name>Johnny</name>
<description>some text here... eeeee</description>
</category>
<category>
<name>Mary</name>
<description>Talkative... etc.. etc</description>
</category>
</categories>
 
As far as I can see you have two real choices here. Once a user selects a person, you re-open the xml file, search for that person and put the contents of the description file into the textbox. Alternatively (and possibly a better solution) is to load the descriptions at the same time as the names and store them in a class.

How exactly you do this will depend on how you are currently reading in the xml file.
 
Back
Top