By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,020 Members | 1,297 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,020 IT Pros & Developers. It's quick & easy.

How to bind to XML??

P: n/a
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
Nov 17 '05 #1
Share this Question
Share on Google+
7 Replies


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

Can anyone guide me and Dan.

Regards,
Rahul.

"Dan" wrote:
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

Nov 17 '05 #2

P: n/a
Ron
"Dan" <er****@ecenet.com> wrote in message
news:a-********************@trueband.net...
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.
Nov 17 '05 #3

P: n/a
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.
"Ron" <no***@nowhere.com> wrote in message
news:uz**************@tk2msftngp13.phx.gbl...
"Dan" <er****@ecenet.com> wrote in message
news:a-********************@trueband.net...
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.

Nov 17 '05 #4

P: n/a
Ron
"Dan" <Da*@DanTheMan.com> wrote in message
news:y8********************@trueband.net...
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.
Nov 17 '05 #5

P: n/a
Ron
"Ron" <no***@nowhere.com> wrote in message
news:ed**************@tk2msftngp13.phx.gbl...
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.
Nov 17 '05 #6

P: n/a
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.
"Ron" <no***@nowhere.com> wrote in message
news:e0**************@TK2MSFTNGP12.phx.gbl...
"Ron" <no***@nowhere.com> wrote in message
news:ed**************@tk2msftngp13.phx.gbl...
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.

Nov 17 '05 #7

P: n/a
Ron
"Dan" <Da*@DanTheMan.com> wrote in message
news:mb********************@trueband.net...
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.
Nov 17 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.