How to bind to XML??

D

Dan

Very newbie question here:

Any suggestions on how to bind an XML file to a combobox and datagrid? I've
had no problem reading the data in a datagrid. But the combobox is another
story.

I want to select an employees name in a combobox and then display details of
selected employee in a datagrid. So everytime a new employee was selected,
the datagrid would change accordingly. Any good ideas on how this is done?
Would that data be placed in one single xml file with nested elements, or do
I need multiple xml files(one for every employee)?

Thanks
 
G

Guest

I want to do a similar thing using access database, textbox and list view.

Can anyone guide me and Dan.

Regards,
Rahul.
 
R

Ron

Dan said:
Very newbie question here:

Any suggestions on how to bind an XML file to a combobox and datagrid?
I've
had no problem reading the data in a datagrid. But the combobox is
another
story.

I want to select an employees name in a combobox and then display details
of
selected employee in a datagrid. So everytime a new employee was
selected,
the datagrid would change accordingly. Any good ideas on how this is
done?
Would that data be placed in one single xml file with nested elements, or
do
I need multiple xml files(one for every employee)?

Thanks

Hi Dan.
You can read the XML into a DataSet. Have a look at the VS/MSDN help.
Regards,
Ron.
 
D

Dan

Hi Ron,

I was able to read the xml file into a DataSet with no problem... the
problem comes when I try to list one element from the xml file in the
combobox, and then display the details (ie: remaining elements) in the
DataGrid.

I could also write an xml file for each employee. There's a little more than
100 employees that I'd need to describe data for so I don't know if that'd
be excessive or not. Oh well.
 
R

Ron

Dan said:
Hi Ron,

I was able to read the xml file into a DataSet with no problem... the
problem comes when I try to list one element from the xml file in the
combobox, and then display the details (ie: remaining elements) in the
DataGrid.

I could also write an xml file for each employee. There's a little more
than
100 employees that I'd need to describe data for so I don't know if that'd
be excessive or not. Oh well.
<snip>
Does the dataset contain one table for the employee data and another table
for the details? If it does, you can set a data relation between them, and
then bind the combobox to the employee table and the datagrid to the details
table. When you changed the selected index of the combobox, the datagrid
should change to show the new details. The help has good information on this
sort of thing.
Regards,
Ron.
 
R

Ron

Ron said:
Does the dataset contain one table for the employee data and another table
for the details? If it does, you can set a data relation between them, and
then bind the combobox to the employee table and the datagrid to the
details table. When you changed the selected index of the combobox, the
datagrid should change to show the new details. The help has good
information on this sort of thing.
Regards,
Ron.
What I should have written was bind the combobox to the employee table and
the datagrid to the data relation.
There is a walkthrough called Creating a Master-Detail Windows Form. That
example uses SQL Server and a listbox, not a combobox, but I am sure you can
adapt the idea to suit what you require.

Good Luck,
Ron.
 
D

Dan

Thanks, I'll take a look at that Master Detail tutorial. I also grabbed the
MSDE, if all else fails, maybe I could just "pack" my own db with the app.
 
R

Ron

Dan said:
Thanks, I'll take a look at that Master Detail tutorial. I also grabbed
the
MSDE, if all else fails, maybe I could just "pack" my own db with the app.
<snip>
Ok Dan.
Well, good luck on the solution you finally decide on.
Regards,
Ron.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top