Binding XML file to DataGridView in Windows Applications with C#

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
<span style="font-size:9.5pt;color:black Hi,
<span style="font-size:9.5pt;color:black Please forgive me if the question is too simple, I am a beginner.
<span style="font-size:9.5pt;color:black Part of my application I am working on requires a contact list (similar to the one in Outlook). I decided on the following:
<p class=MsoNormal style="margin-left:0.5in;text-indent:-0.25in;tab-stops:list .5in <span style="font-size:9.5pt;color:black;font-family:Arial <span style=" 1.<span style="font:7pt Times New Roman        <span style="font-size:9.5pt;color:black;font-family:Arial Create a Class with public properties for the contact details (name, email, phone, etc.).
<p class=MsoNormal style="margin-left:0.5in;text-indent:-0.25in;tab-stops:list .5in <span style="font-size:9.5pt;color:black;font-family:Arial <span style="font-size:9.5pt;color:black;font-family:Arial <span style=" 2.<span style="font:7pt Times New Roman        <span style="font-size:9.5pt;color:black;font-family:Arial Use List<MyContactsClass> to combine each contact into an array.
<p class=MsoNormal style="margin-left:0.5in;text-indent:-0.25in;tab-stops:list .5in <span style="font-size:9.5pt;color:black;font-family:Arial <span style=" 3.<span style="font:7pt Times New Roman        <span style="font-size:9.5pt;color:black;font-family:Arial Serialize List<MyContactsClass> to XML and store on a disk.
<p class=MsoNormal style="margin-left:0.5in;text-indent:-0.25in;tab-stops:list .5in <span style="font-size:9.5pt;color:black;font-family:Arial <span style=" 4.<span style="font:7pt Times New Roman        <span style="font-size:9.5pt;color:black;font-family:Arial For retrieval and display, I have two options:
<p class=MsoNormal style="margin-left:1in;text-indent:-0.25in;tab-stops:list 1.0in <span style="font-size:10pt;color:black;font-family:Courier New <span style=" o<span style="font:7pt Times New Roman         <span style="font-size:9.5pt;color:black;font-family:Arial Use DataGridView bound to XML file.
<p class=MsoNormal style="margin-left:1in;text-indent:-0.25in;tab-stops:list 1.0in <span style="font-size:10pt;color:black;font-family:Courier New <span style=" o<span style="font:7pt Times New Roman         <span style="font-size:9.5pt;color:black;font-family:Arial Deserialize XML to my List<MyContactsClass> and bind this to DataGridView.
<span style="font-size:9.5pt;color:black I am having trouble with point 4; most topics available suggest using XMLDataSource which is available in ASP.NET, but I need to bind XML in Windows Forms.
<span style="font-size:9.5pt;color:black Id appreciate if someone could help me, and offer some suggestions not only for point 4, but also for the overall design of this portion of the application such as performance and other considerations.
<span style="font-size:9.5pt;color:black Thank you in advance!

View the full article
 
Back
Top