<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Linq</title>
        <link>http://onteorasoftware.com/category/20.aspx</link>
        <description>Linq</description>
        <language>en-US</language>
        <copyright>Ken Tucker</copyright>
        <generator>Subtext Version 2.1.2.2</generator>
        <item>
            <title>Paging a Windows Forms DataGridView with LINQ</title>
            <link>http://blog.onteorasoftware.net/archive/2009/10/11/paging-a-windows-forms-datagridview-with-linq.aspx</link>
            <description>&lt;p&gt;Since Visual Studio 2008 is due out by the end of the Month I am updating some of my datagridview samples for LINQ. &lt;/p&gt;
&lt;p&gt;To start off create a new windows forms application in VS 2008 make sure you select FrameWork 3.5 so you can use linq &lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;&lt;img alt="" width="804" height="480" src="/image.axd?picture=NewProject.png" /&gt; &lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;I now added a new Linq to Sql designer to the project and named it Northwind.  Drag the Northwind Products Table on to the design surface from the Server Explorer. &lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;&lt;img alt="" width="510" height="392" src="/image.axd?picture=LinqToSql.png" /&gt; &lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;On your windows forms add a DataGridView (DataGridView1) and a NumericUpDown control (nuPage).  For this example I will have the datagridview show 15 items at a time.  In the form load event we will figure out how many pages there are and load the first 15 items into the datagridview.  In the NumericUpdown controls value changed event we will update the data displayed &lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;Public Class Form1&lt;br /&gt;
    Dim bs As New BindingSource &lt;/p&gt;
&lt;p&gt;    Private intPages As Integer&lt;br /&gt;
    Dim db As New NorthwindDataContext &lt;/p&gt;
&lt;p&gt;    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load&lt;br /&gt;
        intPages = Math.Ceiling(db.Products.Count / 15)&lt;br /&gt;
        nuPage.Maximum = intPages&lt;br /&gt;
        nuPage.Minimum = 1&lt;br /&gt;
        Dim p = From prod In db.Products _&lt;br /&gt;
                Select prod Skip 0 Take 15&lt;br /&gt;
        bs.DataSource = p&lt;br /&gt;
        bs.AllowNew = False&lt;br /&gt;
        DataGridView1.DataSource = bs&lt;br /&gt;
    End Sub &lt;/p&gt;
&lt;p&gt;&lt;br /&gt;
    Private Sub nuPage_ValueChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles nuPage.ValueChanged&lt;br /&gt;
        Dim p = From prod In db.Products _&lt;br /&gt;
                Select prod Skip (nuPage.Value - 1) * 15 Take 15&lt;br /&gt;
        bs.DataSource = p&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class &lt;/p&gt;&lt;img src="http://blog.onteorasoftware.net/aggbug/47.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Blog Author</dc:creator>
            <guid>http://blog.onteorasoftware.net/archive/2009/10/11/paging-a-windows-forms-datagridview-with-linq.aspx</guid>
            <pubDate>Sun, 11 Oct 2009 09:48:23 GMT</pubDate>
            <wfw:comment>http://blog.onteorasoftware.net/comments/47.aspx</wfw:comment>
            <comments>http://blog.onteorasoftware.net/archive/2009/10/11/paging-a-windows-forms-datagridview-with-linq.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://blog.onteorasoftware.net/comments/commentRss/47.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Datagridview and Linq issue</title>
            <link>http://blog.onteorasoftware.net/archive/2008/01/28/datagridview-and-linq-issue.aspx</link>
            <description>&lt;p&gt;
I had some one ask me an interesting question about using linq with the datagridview 
&lt;/p&gt;
&lt;p&gt;
When I bind a datagridview to this query 
&lt;/p&gt;
&lt;p&gt;
Dim names() As String = {"hello11", "hello212", "hello123", "hello124", "hello2325", "hello336", "hello457"}&lt;br /&gt;
Dim query = From s In names _&lt;br /&gt;
            Order By s _&lt;br /&gt;
            Select s&lt;br /&gt;
Dim bs As New BindingSource&lt;br /&gt;
bs.DataSource = query&lt;br /&gt;
DataGridView1.DataSource = bs 
&lt;/p&gt;
&lt;p&gt;
Why do I get these results? 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="/image.axd?picture=WindowsLiveWriter/DatagridviewandLinqissue_5C98/image_4.png"&gt;&lt;img style="border: 0px" src="/image.axd?picture=WindowsLiveWriter/DatagridviewandLinqissue_5C98/image_thumb_1.png" border="0" alt="image" width="164" height="218" /&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
The answer the datagridview will show the properties of the class in the list bound to the datagridview.  In this case we are bound to a list of string and the only bindable property is its Length.   
&lt;/p&gt;
&lt;p&gt;
If you change the query to this 
&lt;/p&gt;
&lt;p&gt;
Dim names() As String = {"hello11", "hello212", "hello123", "hello124", "hello2325", "hello336", "hello457"}&lt;br /&gt;
Dim query = From s In names _&lt;br /&gt;
            Order By s _&lt;br /&gt;
            Select New With {.Name = s}&lt;br /&gt;
Dim bs As New BindingSource&lt;br /&gt;
bs.DataSource = query&lt;br /&gt;
DataGridView1.DataSource = bs 
&lt;/p&gt;
&lt;p&gt;
You will get the expected results 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="/image.axd?picture=WindowsLiveWriter/DatagridviewandLinqissue_5C98/image_6.png"&gt;&lt;img style="border: 0px" src="/image.axd?picture=WindowsLiveWriter/DatagridviewandLinqissue_5C98/image_thumb_2.png" border="0" alt="image" width="164" height="219" /&gt;&lt;/a&gt;   
&lt;/p&gt;
&lt;p&gt;
I should also mention that you can not bind a datagridview to a linq query directory.  You need to bind the query to a bindingsource and bind the datagridview to the bindingsource or bind the datagridview to the queries ToList method. 
&lt;/p&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fwww.onteorasoftware.net%2fpost%2fDatagridview-and-Linq-issue.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.onteorasoftware.net%2fpost%2fDatagridview-and-Linq-issue.aspx" border="0" alt="kick it on DotNetKicks.com" width="164" height="30" /&gt;&lt;/a&gt; 
&lt;img src="http://blog.onteorasoftware.net/aggbug/33.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Ken Tucker</dc:creator>
            <guid>http://blog.onteorasoftware.net/archive/2008/01/28/datagridview-and-linq-issue.aspx</guid>
            <pubDate>Mon, 28 Jan 2008 07:40:47 GMT</pubDate>
            <wfw:comment>http://blog.onteorasoftware.net/comments/33.aspx</wfw:comment>
            <comments>http://blog.onteorasoftware.net/archive/2008/01/28/datagridview-and-linq-issue.aspx#feedback</comments>
            <slash:comments>6</slash:comments>
            <wfw:commentRss>http://blog.onteorasoftware.net/comments/commentRss/33.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Use Linq to create a random list of numbers</title>
            <link>http://blog.onteorasoftware.net/archive/2008/01/27/use-linq-to-create-a-random-list-of-numbers.aspx</link>
            <description>&lt;p&gt;
Here is a simple linq query which places the numbers from 1 and 150 in a random order 
&lt;/p&gt;
&lt;p&gt;
 
&lt;/p&gt;
&lt;p&gt;
Dim r As New Random(Now.Ticks Mod Int32.MaxValue) 
&lt;/p&gt;
&lt;p&gt;
Dim rndLst = From l In (From num In Enumerable.Range(1, 150) _&lt;br /&gt;
             Select New With {.Num = num, .pos = r.Next(1, 150)}) _&lt;br /&gt;
             Order By l.pos _&lt;br /&gt;
             Select l.Num 
&lt;/p&gt;
&lt;p&gt;
For Each i In rndLst&lt;br /&gt;
    Console.WriteLine(i)&lt;br /&gt;
Next 
&lt;/p&gt;
&lt;br /&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fonteorasoftware.net%2fpost%2fUse-Linq-to-create-a-random-list-of-numbers.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fonteorasoftware.net%2fpost%2fUse-Linq-to-create-a-random-list-of-numbers.aspx" border="0" alt="kick it on DotNetKicks.com" width="82" height="18" /&gt;&lt;/a&gt; 
&lt;img src="http://blog.onteorasoftware.net/aggbug/41.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Ken Tucker</dc:creator>
            <guid>http://blog.onteorasoftware.net/archive/2008/01/27/use-linq-to-create-a-random-list-of-numbers.aspx</guid>
            <pubDate>Sun, 27 Jan 2008 10:44:20 GMT</pubDate>
            <wfw:comment>http://blog.onteorasoftware.net/comments/41.aspx</wfw:comment>
            <comments>http://blog.onteorasoftware.net/archive/2008/01/27/use-linq-to-create-a-random-list-of-numbers.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://blog.onteorasoftware.net/comments/commentRss/41.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Linq to DataSet</title>
            <link>http://blog.onteorasoftware.net/archive/2007/11/29/linq-to-dataset.aspx</link>
            <description>&lt;p&gt;
Linq allows you to query the data in a dataset.  For this example I load the Products and Categories table from the Northwind Database.  I then do a join query to export the Product Name, Unit Price, and Category Name into a list which I display in a datagridview.  Note a query of this type will not display in a datagridview you need to set the datasource equal to the query's Tolist method. 
&lt;/p&gt;
&lt;p&gt;
Imports System.Data.SqlClient 
&lt;/p&gt;
&lt;p&gt;
Public Class Form1 
&lt;/p&gt;
&lt;p&gt;
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load&lt;br /&gt;
        Dim strConn As String = _&lt;br /&gt;
                "Server = .\SQLEXPRESS;Database = NorthWind; Integrated Security = SSPI;"&lt;br /&gt;
        Dim conn As New SqlConnection(strConn)&lt;br /&gt;
        Dim da As New SqlDataAdapter("Select * from Products; Select * from Categories", conn)&lt;br /&gt;
        Dim ds As New DataSet&lt;br /&gt;
        da.Fill(ds)&lt;br /&gt;
        Debug.Print(ds.Tables(1).TableName)&lt;br /&gt;
        Dim products As DataTable = ds.Tables(0)&lt;br /&gt;
        Dim categories As DataTable = ds.Tables(1)&lt;br /&gt;
        Dim query = From p In products.AsEnumerable _&lt;br /&gt;
                    Join c In categories.AsEnumerable _&lt;br /&gt;
                    On p.Field(Of Int32)("CategoryID") Equals c.Field(Of Int32)("CategoryID") _&lt;br /&gt;
                    Select New With {.ProductName = p.Field(Of String)("ProductName"), _&lt;br /&gt;
                                    .Price = p.Field(Of Decimal)("UnitPrice"), _&lt;br /&gt;
                                    .Category = c.Field(Of String)("CategoryName")} 
&lt;/p&gt;
&lt;p&gt;
        DataGridView1.DataSource = query.ToList&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class
&lt;/p&gt;
&lt;img src="http://blog.onteorasoftware.net/aggbug/46.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Ken Tucker</dc:creator>
            <guid>http://blog.onteorasoftware.net/archive/2007/11/29/linq-to-dataset.aspx</guid>
            <pubDate>Thu, 29 Nov 2007 08:13:25 GMT</pubDate>
            <wfw:comment>http://blog.onteorasoftware.net/comments/46.aspx</wfw:comment>
            <comments>http://blog.onteorasoftware.net/archive/2007/11/29/linq-to-dataset.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://blog.onteorasoftware.net/comments/commentRss/46.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Using Linq to XML to create an excel spreadsheet</title>
            <link>http://blog.onteorasoftware.net/archive/2007/11/24/using-linq-to-xml-to-create-an-excel-spreadsheet.aspx</link>
            <description>&lt;p&gt;
For this example we are going to create a Excel 2007 spreadsheet using the &lt;a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=AD0B72FB-4A1D-4C52-BDB5-7DD7E816D046&amp;amp;displaylang=en"&gt;Microsoft OpenXml Sdk&lt;/a&gt; and Linq to XML. 
&lt;/p&gt;
&lt;p&gt;
To start with lets create a new Windows forms app which targets the .Net Framework 3.5.  Add a Linq to Sql design surface to your project and name it Northwind and drag the Northwind Products table on to the surface.  On the windows form I added a DataGridview to display the data we are going to export to excel.  We also need a button named btnExport on the form. 
&lt;/p&gt;
&lt;p&gt;
To create a excel spreadsheet we need to use the openxml sdk to create a spreadsheet document, workbook, worksheet, and a string table.  
&lt;/p&gt;
&lt;p&gt;
       Using doc = SpreadsheetDocument.Create("Export.xlsx", SpreadsheetDocumentType.Workbook)&lt;br /&gt;
            Dim workbook = doc.AddWorkbookPart&lt;br /&gt;
            Dim stringTable = workbook.AddNewPart(Of SharedStringTablePart)()&lt;br /&gt;
            Dim worksheet = workbook.AddNewPart(Of WorksheetPart)() 
&lt;/p&gt;
&lt;p&gt;
The worksheet, workbook, and string table are xml documents contained inside a package.  Before we get to far we need to import a few xml namespaces 
&lt;/p&gt;
&lt;p&gt;
 
&lt;/p&gt;
&lt;p&gt;
Imports &amp;lt;xmlns="&lt;a href="http://schemas.openxmlformats.org/spreadsheetml/2006/main&amp;quot;"&gt;http://schemas.openxmlformats.org/spreadsheetml/2006/main"&lt;/a&gt;&amp;gt;&lt;br /&gt;
Imports &amp;lt;xmlns:r="&lt;a href="http://schemas.openxmlformats.org/officeDocument/2006/relationships&amp;quot;"&gt;http://schemas.openxmlformats.org/officeDocument/2006/relationships"&lt;/a&gt;&amp;gt; 
&lt;/p&gt;
&lt;p&gt;
 
&lt;/p&gt;
&lt;p&gt;
Now that we imported the name space we can use some of the new xml features in VB 2008 to create the xml documents.  Since we are not using a string table we just need a blank xml file 
&lt;/p&gt;
&lt;p&gt;
 
&lt;/p&gt;
&lt;p&gt;
Dim xmlStringTable = &amp;lt;sst&amp;gt;&amp;lt;/sst&amp;gt; 
&lt;/p&gt;
&lt;p&gt;
The workbook xml needs to relate the spreadsheet with its id 
&lt;/p&gt;
&lt;p&gt;
 
&lt;/p&gt;
&lt;p&gt;
           Dim xmlWorkbook = &amp;lt;workbook&amp;gt;&lt;br /&gt;
                                  &amp;lt;sheets&amp;gt;&lt;br /&gt;
                                      &amp;lt;sheet name="Exported" sheetId="1" r:id=&amp;lt;%= sheetId %&amp;gt;&amp;gt;&amp;lt;/sheet&amp;gt;&lt;br /&gt;
                                  &amp;lt;/sheets&amp;gt;&lt;br /&gt;
                              &amp;lt;/workbook&amp;gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;br /&gt;
Note the &amp;lt;%= sheetId %&amp;gt; allows you to get data from a variable 
&lt;/p&gt;
&lt;p&gt;
 
&lt;/p&gt;
&lt;p&gt;
Finally we need to create the worksheet.  In the worksheet we set the column widths and use a linq query to populate the data. 
&lt;/p&gt;
&lt;p&gt;
            Dim xmlWorkSheet = &amp;lt;worksheet&amp;gt;&lt;br /&gt;
                                   &amp;lt;sheetFormatPr defaultRowHeight="15"/&amp;gt;&lt;br /&gt;
                                   &amp;lt;cols&amp;gt;&lt;br /&gt;
                                       &amp;lt;col min="1" max="1" width="30" bestFit="1" customWidth="1"/&amp;gt;&lt;br /&gt;
                                       &amp;lt;col min="2" max="2" width="10" bestFit="1" customWidth="1"/&amp;gt;&lt;br /&gt;
                                   &amp;lt;/cols&amp;gt;&lt;br /&gt;
                                   &amp;lt;sheetData&amp;gt;&lt;br /&gt;
                                       &amp;lt;row&amp;gt;&lt;br /&gt;
                                           &amp;lt;c t="inlineStr"&amp;gt;&lt;br /&gt;
                                               &amp;lt;is&amp;gt;&lt;br /&gt;
                                                   &amp;lt;t&amp;gt;Product Name&amp;lt;/t&amp;gt;&lt;br /&gt;
                                               &amp;lt;/is&amp;gt;&lt;br /&gt;
                                           &amp;lt;/c&amp;gt;&lt;br /&gt;
                                           &amp;lt;c t="inlineStr"&amp;gt;&lt;br /&gt;
                                               &amp;lt;is&amp;gt;&lt;br /&gt;
                                                   &amp;lt;t&amp;gt;Unit Price&amp;lt;/t&amp;gt;&lt;br /&gt;
                                               &amp;lt;/is&amp;gt;&lt;br /&gt;
                                           &amp;lt;/c&amp;gt;&lt;br /&gt;
                                       &amp;lt;/row&amp;gt;&lt;br /&gt;
                                       &amp;lt;%= From p In db.Products Select _&lt;br /&gt;
                                           &amp;lt;row&amp;gt;&lt;br /&gt;
                                               &amp;lt;c t="inlineStr"&amp;gt;&lt;br /&gt;
                                                   &amp;lt;is&amp;gt;&lt;br /&gt;
                                                       &amp;lt;t&amp;gt;&amp;lt;%= p.ProductName %&amp;gt;&amp;lt;/t&amp;gt;&lt;br /&gt;
                                                   &amp;lt;/is&amp;gt;&lt;br /&gt;
                                               &amp;lt;/c&amp;gt;&lt;br /&gt;
                                               &amp;lt;c&amp;gt;&lt;br /&gt;
                                                   &amp;lt;v&amp;gt;&amp;lt;%= p.UnitPrice %&amp;gt;&amp;lt;/v&amp;gt;&lt;br /&gt;
                                               &amp;lt;/c&amp;gt;&lt;br /&gt;
                                           &amp;lt;/row&amp;gt; %&amp;gt;&lt;br /&gt;
                                   &amp;lt;/sheetData&amp;gt;&lt;br /&gt;
                               &amp;lt;/worksheet&amp;gt; 
&lt;/p&gt;
&lt;p&gt;
 
&lt;/p&gt;
&lt;p&gt;
Here is the function for writing the xml to the file 
&lt;/p&gt;
&lt;p&gt;
   Sub WriteXmlToPart(ByVal part As OpenXmlPart, ByVal x As XElement)&lt;br /&gt;
        Dim fs As New IO.StreamWriter(part.GetStream, New System.Text.UTF8Encoding) 
&lt;/p&gt;
&lt;p&gt;
        Dim xmlWriter As New Xml.XmlTextWriter(part.GetStream, New UTF8Encoding)&lt;br /&gt;
        xmlWriter.Formatting = Xml.Formatting.Indented&lt;br /&gt;
        Dim enc As New UTF8Encoding 
&lt;/p&gt;
&lt;p&gt;
        xmlWriter.WriteStartDocument()&lt;br /&gt;
        x.WriteTo(xmlWriter)&lt;br /&gt;
        xmlWriter.WriteEndDocument()&lt;br /&gt;
        xmlWriter.Flush()&lt;br /&gt;
        xmlWriter.Close()&lt;br /&gt;
    End Sub 
&lt;/p&gt;
&lt;p&gt;
 
&lt;/p&gt;
&lt;p&gt;
Here is the complete listing for program 
&lt;/p&gt;
&lt;p&gt;
 
&lt;/p&gt;
&lt;p&gt;
Imports Microsoft.Office.DocumentFormat.OpenXml.Packaging&lt;br /&gt;
Imports System.Text&lt;br /&gt;
Imports &amp;lt;xmlns="&lt;a href="http://schemas.openxmlformats.org/spreadsheetml/2006/main&amp;quot;"&gt;http://schemas.openxmlformats.org/spreadsheetml/2006/main"&lt;/a&gt;&amp;gt;&lt;br /&gt;
Imports &amp;lt;xmlns:r="&lt;a href="http://schemas.openxmlformats.org/officeDocument/2006/relationships&amp;quot;"&gt;http://schemas.openxmlformats.org/officeDocument/2006/relationships"&lt;/a&gt;&amp;gt; 
&lt;/p&gt;
&lt;p&gt;
Public Class Form1&lt;br /&gt;
    Dim bs As New BindingSource&lt;br /&gt;
    Dim db As New NorthwindDataContext 
&lt;/p&gt;
&lt;p&gt;
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load&lt;br /&gt;
        bs.DataSource = From p In db.Products _&lt;br /&gt;
                        Select p.ProductName, p.UnitPrice 
&lt;/p&gt;
&lt;p&gt;
        DataGridView1.DataSource = bs&lt;br /&gt;
    End Sub 
&lt;/p&gt;
&lt;p&gt;
    Private Sub btnExport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExport.Click&lt;br /&gt;
        Using doc = SpreadsheetDocument.Create("Export.xlsx", SpreadsheetDocumentType.Workbook)&lt;br /&gt;
            Dim workbook = doc.AddWorkbookPart&lt;br /&gt;
            Dim stringTable = workbook.AddNewPart(Of SharedStringTablePart)()&lt;br /&gt;
            Dim worksheet = workbook.AddNewPart(Of WorksheetPart)()&lt;br /&gt;
            Dim sheetId = workbook.GetIdOfPart(worksheet) 
&lt;/p&gt;
&lt;p&gt;
            'create the string table &lt;br /&gt;
            Dim xmlStringTable = &amp;lt;sst&amp;gt;&amp;lt;/sst&amp;gt;&lt;br /&gt;
            WriteXmlToPart(stringTable, xmlStringTable) 
&lt;/p&gt;
&lt;p&gt;
            'create the workbook&lt;br /&gt;
            Dim xmlWorkbook = &amp;lt;workbook&amp;gt;&lt;br /&gt;
                                  &amp;lt;sheets&amp;gt;&lt;br /&gt;
                                      &amp;lt;sheet name="Exported" sheetId="1" r:id=&amp;lt;%= sheetId %&amp;gt;&amp;gt;&amp;lt;/sheet&amp;gt;&lt;br /&gt;
                                  &amp;lt;/sheets&amp;gt;&lt;br /&gt;
                              &amp;lt;/workbook&amp;gt;&lt;br /&gt;
            WriteXmlToPart(workbook, xmlWorkbook) 
&lt;/p&gt;
&lt;p&gt;
            'create the spreadsheet&lt;br /&gt;
            Dim xmlWorkSheet = &amp;lt;worksheet&amp;gt;&lt;br /&gt;
                                   &amp;lt;sheetFormatPr defaultRowHeight="15"/&amp;gt;&lt;br /&gt;
                                   &amp;lt;cols&amp;gt;&lt;br /&gt;
                                       &amp;lt;col min="1" max="1" width="30" bestFit="1" customWidth="1"/&amp;gt;&lt;br /&gt;
                                       &amp;lt;col min="2" max="2" width="10" bestFit="1" customWidth="1"/&amp;gt;&lt;br /&gt;
                                   &amp;lt;/cols&amp;gt;&lt;br /&gt;
                                   &amp;lt;sheetData&amp;gt;&lt;br /&gt;
                                       &amp;lt;row&amp;gt;&lt;br /&gt;
                                           &amp;lt;c t="inlineStr"&amp;gt;&lt;br /&gt;
                                               &amp;lt;is&amp;gt;&lt;br /&gt;
                                                   &amp;lt;t&amp;gt;Product Name&amp;lt;/t&amp;gt;&lt;br /&gt;
                                               &amp;lt;/is&amp;gt;&lt;br /&gt;
                                           &amp;lt;/c&amp;gt;&lt;br /&gt;
                                           &amp;lt;c t="inlineStr"&amp;gt;&lt;br /&gt;
                                               &amp;lt;is&amp;gt;&lt;br /&gt;
                                                   &amp;lt;t&amp;gt;Unit Price&amp;lt;/t&amp;gt;&lt;br /&gt;
                                               &amp;lt;/is&amp;gt;&lt;br /&gt;
                                           &amp;lt;/c&amp;gt;&lt;br /&gt;
                                       &amp;lt;/row&amp;gt;&lt;br /&gt;
                                       &amp;lt;%= From p In db.Products Select _&lt;br /&gt;
                                           &amp;lt;row&amp;gt;&lt;br /&gt;
                                               &amp;lt;c t="inlineStr"&amp;gt;&lt;br /&gt;
                                                   &amp;lt;is&amp;gt;&lt;br /&gt;
                                                       &amp;lt;t&amp;gt;&amp;lt;%= p.ProductName %&amp;gt;&amp;lt;/t&amp;gt;&lt;br /&gt;
                                                   &amp;lt;/is&amp;gt;&lt;br /&gt;
                                               &amp;lt;/c&amp;gt;&lt;br /&gt;
                                               &amp;lt;c&amp;gt;&lt;br /&gt;
                                                   &amp;lt;v&amp;gt;&amp;lt;%= p.UnitPrice %&amp;gt;&amp;lt;/v&amp;gt;&lt;br /&gt;
                                               &amp;lt;/c&amp;gt;&lt;br /&gt;
                                           &amp;lt;/row&amp;gt; %&amp;gt;&lt;br /&gt;
                                   &amp;lt;/sheetData&amp;gt;&lt;br /&gt;
                               &amp;lt;/worksheet&amp;gt; 
&lt;/p&gt;
&lt;p&gt;
            WriteXmlToPart(worksheet, xmlWorkSheet) 
&lt;/p&gt;
&lt;p&gt;
        End Using&lt;br /&gt;
    End Sub 
&lt;/p&gt;
&lt;p&gt;
    Sub WriteXmlToPart(ByVal part As OpenXmlPart, ByVal x As XElement)&lt;br /&gt;
        Dim fs As New IO.StreamWriter(part.GetStream, New System.Text.UTF8Encoding) 
&lt;/p&gt;
&lt;p&gt;
        Dim xmlWriter As New Xml.XmlTextWriter(part.GetStream, New UTF8Encoding)&lt;br /&gt;
        xmlWriter.Formatting = Xml.Formatting.Indented&lt;br /&gt;
        Dim enc As New UTF8Encoding 
&lt;/p&gt;
&lt;p&gt;
        xmlWriter.WriteStartDocument()&lt;br /&gt;
        x.WriteTo(xmlWriter)&lt;br /&gt;
        xmlWriter.WriteEndDocument()&lt;br /&gt;
        xmlWriter.Flush()&lt;br /&gt;
        xmlWriter.Close()&lt;br /&gt;
    End Sub 
&lt;/p&gt;
&lt;p&gt;
End Class 
&lt;/p&gt;
&lt;br /&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http%3a%2f%2fwww.onteorasoftware.net%2fpost%2fUsing-Linq-to-XML-to-create-an-excel-spreadsheet.aspx"&gt;&lt;img src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http%3a%2f%2fwww.onteorasoftware.net%2fpost%2fUsing-Linq-to-XML-to-create-an-excel-spreadsheet.aspx" border="0" alt="kick it on DotNetKicks.com" width="82" height="18" /&gt;&lt;/a&gt;
&lt;img src="http://blog.onteorasoftware.net/aggbug/45.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Ken Tucker</dc:creator>
            <guid>http://blog.onteorasoftware.net/archive/2007/11/24/using-linq-to-xml-to-create-an-excel-spreadsheet.aspx</guid>
            <pubDate>Sat, 24 Nov 2007 21:34:56 GMT</pubDate>
            <wfw:comment>http://blog.onteorasoftware.net/comments/45.aspx</wfw:comment>
            <comments>http://blog.onteorasoftware.net/archive/2007/11/24/using-linq-to-xml-to-create-an-excel-spreadsheet.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://blog.onteorasoftware.net/comments/commentRss/45.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Using XLinq to get a list of Photos from Spaces.Live.com</title>
            <link>http://blog.onteorasoftware.net/archive/2007/09/16/using-xlinq-to-get-a-list-of-photos-from-spaces.live.com.aspx</link>
            <description>&lt;h3 align="center"&gt;Using XLinq to get a list of Photos from Spaces.Live.com&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;
Storing photo albums on line is becoming very popular. Spaces.Live.com photo is one place to store albums which exposes its photo albums via an rss feed. I thought it would be nice to test out Visual Studio 2008 XLinq by getting a list of Photo's from the Tampa Code Camp and display them in WPF Listbox. 
&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
The photos I am looking for can be found here. 
&lt;/p&gt;
&lt;a href="http://thedevfish.spaces.live.com/photos/cns!75364D9E73295107!133/feed.rss"&gt;http://thedevfish.spaces.live.com/photos/cns!75364D9E73295107!133/feed.rss&lt;/a&gt; 
&lt;p&gt;
The xml in the rss feed exposes each photo like this 
&lt;/p&gt;
&lt;p&gt;
    &amp;lt;item&amp;gt;&lt;br /&gt;
      &amp;lt;title&amp;gt;volunteers arrived at 630am - nikita polyakov [mvp] led them&amp;lt;/title&amp;gt;&lt;br /&gt;
      &amp;lt;link&amp;gt;http://thedevfish.spaces.live.com/photos/cns!75364D9E73295107!133/cns!75364D9E73295107!134&amp;lt;/link&amp;gt;&lt;br /&gt;
      &amp;lt;description&amp;gt;&amp;lt;p&amp;gt;&amp;lt;a href="http://thedevfish.spaces.live.com&amp;amp;#47;photos&amp;amp;#47;cns&amp;amp;#33;75364D9E73295107&amp;amp;#33;133&amp;amp;#47;cns&amp;amp;#33;75364D9E73295107&amp;amp;#33;134" mce_href="http://thedevfish.spaces.live.com&amp;amp;#47;photos&amp;amp;#47;cns&amp;amp;#33;75364D9E73295107&amp;amp;#33;133&amp;amp;#47;cns&amp;amp;#33;75364D9E73295107&amp;amp;#33;134"&amp;gt;&amp;lt;img src="http://storage.live.com&amp;amp;#47;items&amp;amp;#47;75364D9E73295107&amp;amp;#33;134&amp;amp;#58;thumbnail" mce_src="http://storage.live.com&amp;amp;#47;items&amp;amp;#47;75364D9E73295107&amp;amp;#33;134&amp;amp;#58;thumbnail" border="0"&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/p&amp;gt;&amp;lt;p&amp;gt;volunteers arrived at 630am - nikita polyakov &amp;amp;#91;mvp&amp;amp;#93; led them&amp;lt;/p&amp;gt;&amp;lt;img src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=8446023494112203015&amp;amp;page=RSS%3a+volunteers+arrived+at+630am+-+nikita+polyakov+%5bmvp%5d+led+them&amp;amp;referrer=" mce_src="http://c.services.spaces.live.com/CollectionWebService/c.gif?cid=8446023494112203015&amp;amp;page=RSS%3a+volunteers+arrived+at+630am+-+nikita+polyakov+%5bmvp%5d+led+them&amp;amp;referrer=" width="1px" height="1px" border="0" alt=""&amp;gt;&amp;lt;img style="position:absolute" alt="" width="0px" height="0px" src="http://c.live.com/c.gif?NC=31263&amp;amp;amp;NA=1149&amp;amp;amp;PI=73329&amp;amp;amp;RF=&amp;amp;amp;DI=3919&amp;amp;amp;PS=85545&amp;amp;amp;TP=thedevfish.spaces.live.com&amp;amp;amp;GT1=thedevfish" mce_src="http://c.live.com/c.gif?NC=31263&amp;amp;amp;NA=1149&amp;amp;amp;PI=73329&amp;amp;amp;RF=&amp;amp;amp;DI=3919&amp;amp;amp;PS=85545&amp;amp;amp;TP=thedevfish.spaces.live.com&amp;amp;amp;GT1=thedevfish"&amp;gt;&amp;lt;/description&amp;gt;&lt;br /&gt;
      &amp;lt;comments&amp;gt;http://thedevfish.spaces.live.com/photos/cns!75364D9E73295107!133/&amp;lt;/comments&amp;gt;&lt;br /&gt;
      &amp;lt;guid isPermaLink="false"&amp;gt;cns!75364D9E73295107!134&amp;lt;/guid&amp;gt;&lt;br /&gt;
      &amp;lt;pubDate&amp;gt;Tue, 24 Jul 2007 18:24:10 GMT&amp;lt;/pubDate&amp;gt;&lt;br /&gt;
      &amp;lt;slash:comments&amp;gt;0&amp;lt;/slash:comments&amp;gt;&lt;br /&gt;
      &amp;lt;msn:type&amp;gt;photo&amp;lt;/msn:type&amp;gt;&lt;br /&gt;
      &amp;lt;live:type&amp;gt;photo&amp;lt;/live:type&amp;gt;&lt;br /&gt;
      &amp;lt;live:typelabel&amp;gt;Photo&amp;lt;/live:typelabel&amp;gt;&lt;br /&gt;
      &amp;lt;wfw:commentRss&amp;gt;http://thedevfish.spaces.live.com/photos/cns!75364D9E73295107!133/cns!75364D9E73295107!134/feed.rss&amp;lt;/wfw:commentRss&amp;gt;&lt;br /&gt;
      &amp;lt;wfw:comment&amp;gt;http://thedevfish.spaces.live.com/photos/cns!75364D9E73295107!133/cns!75364D9E73295107!134&amp;lt;/wfw:comment&amp;gt;&lt;br /&gt;
      &amp;lt;dcterms:modified&amp;gt;2007-07-24T18:24:10Z&amp;lt;/dcterms:modified&amp;gt;&lt;br /&gt;
      &amp;lt;enclosure type="image/jpeg" url="http://storage.live.com/items/75364D9E73295107!134" /&amp;gt;&lt;br /&gt;
    &amp;lt;/item&amp;gt; 
&lt;/p&gt;
&lt;br /&gt;
&lt;p&gt;
Lets query the xml feed and get the title for the photo and convert the quid to a link for the photo. The link is http://storage.live.com/items/PictureId. The guid gives us cns!pictureId so we need to replace cns! with http://storage.live.com/items/ 
&lt;/p&gt;
&lt;br /&gt;
&lt;br /&gt;
Class Window1 &lt;br /&gt;
&lt;br /&gt;
    Private Sub Window1_Activated(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Activated&lt;br /&gt;
        Dim strUrl As String = "http://thedevfish.spaces.live.com/photos/cns!75364D9E73295107!133/feed.rss "&lt;br /&gt;
        Dim feeds = XElement.Load(strUrl)&lt;br /&gt;
&lt;br /&gt;
        Dim query = From p In feeds.Element("channel").Elements("item") _&lt;br /&gt;
                  Select title = p.Element("title").Value, link = p.Element("guid").Value.ToString.Replace("cns!", "http://storage.live.com/items/")&lt;br /&gt;
&lt;br /&gt;
        lstPhotos.ItemsSource = query.ToList&lt;br /&gt;
    End Sub&lt;br /&gt;
End Class&lt;br /&gt;
&lt;br /&gt;
Pages XAML&lt;br /&gt;
&lt;br /&gt;
&amp;lt;Window x:Class="Window1"&lt;br /&gt;
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;br /&gt;
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"&lt;br /&gt;
    xmlns:local="clr-namespace:CodeCampPhotos" &lt;br /&gt;
    Title="Window1" Height="300" Width="300"&amp;gt;&lt;br /&gt;
    &amp;lt;Grid&amp;gt;&lt;br /&gt;
&amp;lt;DockPanel&amp;gt;&lt;br /&gt;
&amp;lt;ListBox Name="lstPhotos" DockPanel.Dock="Top"&amp;gt;&lt;br /&gt;
&amp;lt;ListBox.ItemTemplate&amp;gt;&lt;br /&gt;
&amp;lt;DataTemplate&amp;gt;&lt;br /&gt;
&amp;lt;StackPanel&amp;gt;&lt;br /&gt;
&amp;lt;TextBlock Text="{Binding Path=title}" FontSize="10" /&amp;gt;&lt;br /&gt;
&amp;lt;Image Source="{Binding Path = link}" /&amp;gt;&lt;br /&gt;
&amp;lt;/StackPanel&amp;gt;&lt;br /&gt;
&amp;lt;/DataTemplate&amp;gt;&lt;br /&gt;
&amp;lt;/ListBox.ItemTemplate&amp;gt;&lt;br /&gt;
&amp;lt;/ListBox&amp;gt;&lt;br /&gt;
&amp;lt;/DockPanel&amp;gt;&lt;br /&gt;
&amp;lt;/Grid&amp;gt;&lt;br /&gt;
&amp;lt;/Window&amp;gt; 
&lt;img src="http://blog.onteorasoftware.net/aggbug/55.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Ken Tucker</dc:creator>
            <guid>http://blog.onteorasoftware.net/archive/2007/09/16/using-xlinq-to-get-a-list-of-photos-from-spaces.live.com.aspx</guid>
            <pubDate>Sun, 16 Sep 2007 19:39:49 GMT</pubDate>
            <wfw:comment>http://blog.onteorasoftware.net/comments/55.aspx</wfw:comment>
            <comments>http://blog.onteorasoftware.net/archive/2007/09/16/using-xlinq-to-get-a-list-of-photos-from-spaces.live.com.aspx#feedback</comments>
            <wfw:commentRss>http://blog.onteorasoftware.net/comments/commentRss/55.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Using Linq for Master Detail in a DataGridView</title>
            <link>http://blog.onteorasoftware.net/archive/2007/09/16/using-linq-for-master-detail-in-a-datagridview.aspx</link>
            <description>&lt;h3 align="center"&gt;Using Linq for Master Detail in a DataGridView&lt;/h3&gt;&lt;br /&gt;
&lt;p&gt;
&lt;span style="font-size: 13px"&gt;I saw in the MSDN forums someone asking how to do a master details relationship with Linq. It is actually pretty simple. Here are the steps involved on creating the relationship. I am using VS 2008 Beta 2 for this example. &lt;/span&gt;
&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;
	&lt;p&gt;
	&lt;span style="font-size: 13px"&gt;Open up Visual Studio 2008 Beta 2 and create a windows forms Application&lt;/span&gt;
	&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;
	&lt;span style="font-size: 13px"&gt;Add a new Linq 2 Sql classes to the project named Northwind.dbml&lt;/span&gt;
	&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;
	&lt;span style="font-size: 13px"&gt;Drag the Northwind database's Orders and Order Details table onto the surface&lt;/span&gt;
	&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;
	&lt;span style="font-size: 13px"&gt;Save the project and build it&lt;/span&gt;
	&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;
	&lt;span style="font-size: 13px"&gt;Open the data sources window and add a new object data source. Select the orders table&lt;/span&gt;
	&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;
	&lt;span style="font-size: 13px"&gt;Drag the orders table on your windows form&lt;/span&gt;
	&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;
	&lt;span style="font-size: 13px"&gt;Drag the orders_details table on the form &lt;/span&gt;
	&lt;/p&gt;
	&lt;/li&gt;
	&lt;li&gt;
	&lt;p&gt;
	&lt;span style="font-size: 13px"&gt;In the form load event add this code&lt;/span&gt;
	&lt;/p&gt;
	&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&lt;span /&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-size: 13px"&gt;VB&lt;/span&gt;
&lt;/p&gt;
&lt;p style="font-size: 13px; margin: 7px 0px; font-family: Times New Roman"&gt;
&lt;span style="color: #0000ff"&gt;&lt;span&gt;Private&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;Sub&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; Form1_Load(&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;ByVal&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; sender &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;As&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;Object&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;, &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;ByVal&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; e &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;As&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; System.EventArgs) &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;Handles&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;Me&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;.Load&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="font-size: 13px; margin: 7px 0px; font-family: Times New Roman"&gt;
&lt;span style="color: #0000ff"&gt;&lt;span&gt;Dim&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; db &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;As&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;New&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; NorthwindDataContext&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="font-size: 13px; margin: 7px 0px; font-family: Times New Roman"&gt;
&lt;span&gt;&lt;span&gt;OrderBindingSource.DataSource = &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;From&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; o &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;In&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; db.Orders &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;Select&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; o&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="font-size: 16px; margin: 7px 0px; font-family: Times New Roman"&gt;
&lt;span style="font-size: 13px; color: #0000ff"&gt;&lt;span&gt;End&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px"&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: 13px; color: #0000ff"&gt;&lt;span&gt;Sub&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span /&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="font-size: 13px"&gt;C#&lt;/span&gt;
&lt;/p&gt;
&lt;p style="font-size: 13px; margin: 7px 0px; font-family: Times New Roman"&gt;
&lt;span style="color: #0000ff"&gt;&lt;span&gt;private&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;void&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; Form1_Load(&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;object&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; sender, &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080"&gt;&lt;span&gt;EventArgs&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; e)&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="font-size: 13px; margin: 7px 0px; font-family: Times New Roman"&gt;
&lt;span&gt;&lt;span&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="font-size: 13px; margin: 7px 0px; font-family: Times New Roman"&gt;
&lt;span style="color: #008080"&gt;&lt;span&gt;NorthwindDataContext&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; db = &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;new&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #008080"&gt;&lt;span&gt;NorthwindDataContext&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;();&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="font-size: 13px; margin: 7px 0px; font-family: Times New Roman"&gt;
&lt;span&gt;orderBindingSource.DataSource = &lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;from&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; o &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;in&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; db.Orders &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&lt;span&gt;select&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt; o;&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p style="font-size: 13px; margin: 7px 0px; font-family: Times New Roman"&gt;
&lt;span&gt;&lt;span&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span /&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span /&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span /&gt;
&lt;/p&gt;
&lt;br /&gt;
&lt;img src="http://blog.onteorasoftware.net/aggbug/54.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Ken Tucker</dc:creator>
            <guid>http://blog.onteorasoftware.net/archive/2007/09/16/using-linq-for-master-detail-in-a-datagridview.aspx</guid>
            <pubDate>Sun, 16 Sep 2007 17:51:40 GMT</pubDate>
            <wfw:comment>http://blog.onteorasoftware.net/comments/54.aspx</wfw:comment>
            <comments>http://blog.onteorasoftware.net/archive/2007/09/16/using-linq-for-master-detail-in-a-datagridview.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://blog.onteorasoftware.net/comments/commentRss/54.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>