<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx</link><description>In a previous post I showed how to set up related data binding using ComboBoxes against DataSets and a loyal reader asked how this would be done using LINQ and Visual Studio 2008. I assume he meant LINQ to SQL in this case, because remember LINQ can be</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Airline Travel &amp;raquo; Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#7500946</link><pubDate>Thu, 07 Feb 2008 02:24:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7500946</guid><dc:creator>Airline Travel » Related Data Binding and ComboBoxes with LINQ to SQL</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.travel-hilarity.com/airline_travel/?p=1272"&gt;http://www.travel-hilarity.com/airline_travel/?p=1272&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#7516149</link><pubDate>Thu, 07 Feb 2008 16:55:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7516149</guid><dc:creator>Edmilson</dc:creator><description>&lt;p&gt;Hi Beth, &amp;nbsp;My name is &amp;nbsp;Edmilson I&amp;#180;m from Brazil, this is the frist time I write to you... Fristly I&amp;#180;d like to thank you &amp;nbsp;for theach me so much VB.NET, I saw &amp;nbsp;all your videos &amp;nbsp;and read &amp;nbsp;many of articles in your blog, I&amp;#180;m just starting &amp;nbsp;with VB.NET and I&amp;#180;m learning quickly.........I have one question about BINDINGSOURCE......when we use it to get data from DataSet &amp;nbsp;and put it in a form &amp;nbsp;in details mode by default &amp;nbsp;the frist item is already in place, I&amp;#180;d like &amp;nbsp;to start &amp;nbsp;this &amp;nbsp;with the textboxs &amp;nbsp;empty...how &amp;nbsp;cloud I? &amp;nbsp;I know I can use &amp;nbsp;textbox1.clear() &amp;nbsp;but this makes &amp;nbsp;anoter kind of error.&lt;/p&gt;
</description></item><item><title>Creating Lookup Lists with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#7520980</link><pubDate>Thu, 07 Feb 2008 20:36:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7520980</guid><dc:creator>Noticias externas</dc:creator><description>&lt;p&gt;In yesterday&amp;amp;#39;s post I showed you how to bind LINQ to SQL classes to a Combobox in order to filter&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#7525573</link><pubDate>Thu, 07 Feb 2008 23:38:39 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7525573</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Edmilson,&lt;/p&gt;
&lt;p&gt;You would need to either delay or reset the binding to the bindingsource. You can reset it easily by just setting the BindingSource.DatsSource = Nothing in the Load of your form for instance. Then when you wanted to show the records you would just set the DataMember and DataSource properties back to what they were. &lt;/p&gt;
&lt;p&gt;You can take a look at the form's generated code to see the value of those properties if you are using the Data Sources Window and the designer. Just open the Form1.Designer.vb file and have a look. &lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#7527330</link><pubDate>Fri, 08 Feb 2008 01:08:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7527330</guid><dc:creator>Edmilson</dc:creator><description>&lt;p&gt;Hello Beth,&lt;/p&gt;
&lt;p&gt;Thanks for answer, but it did not work I put my bindingsource like you said &amp;nbsp; Me.PedidosBindingSource.DataMember = Nothing.......in the load of my form &amp;nbsp;but this causes some kind of exeption...&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#7528321</link><pubDate>Fri, 08 Feb 2008 01:54:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7528321</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;You may be trying to access a row directly somewhere. Step through the code and make sure you are checking that the BindingSource.Position is not -1 before you access rows on it. &lt;/p&gt;
</description></item><item><title>Beth Massi on LINQ DataBinding to ComboBoxes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#7595915</link><pubDate>Mon, 11 Feb 2008 03:18:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7595915</guid><dc:creator>Hot Topics</dc:creator><description>&lt;p&gt;Two recent LINQ databinding with ComboBoxes posts from Beth Massi of the Visual Basic team. Creating&lt;/p&gt;
</description></item><item><title>One-To-Many (Master-Detail) Forms with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#7804902</link><pubDate>Wed, 20 Feb 2008 02:11:15 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7804902</guid><dc:creator>Beth Massi - Sharing the goodness that is VB</dc:creator><description>&lt;p&gt;In my previous posts here and here I showed how to use LINQ to SQL classes with a couple different Combobox&lt;/p&gt;
</description></item><item><title>Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#7897744</link><pubDate>Tue, 26 Feb 2008 04:04:26 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7897744</guid><dc:creator>Beth Massi - Sharing the goodness that is VB</dc:creator><description>&lt;p&gt;In the last few posts on LINQ to SQL I've showed how to set up an object model using the O/R designer&lt;/p&gt;
</description></item><item><title>Creating Lookup Lists with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#7897789</link><pubDate>Tue, 26 Feb 2008 04:16:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7897789</guid><dc:creator>Beth Massi - Sharing the goodness that is VB</dc:creator><description>&lt;p&gt;In yesterday's post I showed you how to bind LINQ to SQL classes to a Combobox in order to filter records&lt;/p&gt;
</description></item><item><title>Simple Validation with LINQ to SQL Classes</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#7897855</link><pubDate>Tue, 26 Feb 2008 04:29:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7897855</guid><dc:creator>Noticias externas</dc:creator><description>&lt;p&gt;In the last few posts on LINQ to SQL I&amp;amp;#39;ve showed how to set up an object model using the O/R designer&lt;/p&gt;
</description></item><item><title>LINQ to SQL N-Tier Smart Client - Part 1 Building the Middle-Tier</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#8385505</link><pubDate>Sat, 12 Apr 2008 19:27:10 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8385505</guid><dc:creator>Beth Massi - Sharing the goodness that is VB</dc:creator><description>&lt;p&gt;In my previous posts on LINQ to SQL I showed how to build LINQ to SQL classes and set up the data binding&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#8410277</link><pubDate>Sat, 19 Apr 2008 19:57:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8410277</guid><dc:creator>Brent</dc:creator><description>&lt;p&gt;Just wondering what component or mechanism you use to color your code in your blog posts.&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#8415765</link><pubDate>Tue, 22 Apr 2008 03:53:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8415765</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Brent,&lt;/p&gt;
&lt;p&gt;I use Live Writer with an add-in installed that pastes code from Visual Studio.&lt;/p&gt;
&lt;p&gt;You can download Live Writer here: &lt;a rel="nofollow" target="_new" href="http://get.live.com/writer/overview"&gt;http://get.live.com/writer/overview&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Then install this add-in so that you can paste code from VS and preserve formatting: &lt;a rel="nofollow" target="_new" href="http://gallery.live.com/liveItemDetail.aspx?li=d8835a5e-28da-4242-82eb-e1a006b083b9&amp;amp;l=8"&gt;http://gallery.live.com/liveItemDetail.aspx?li=d8835a5e-28da-4242-82eb-e1a006b083b9&amp;amp;l=8&lt;/a&gt; . To use the plug-in, copy the code from VS then in Live Writer select the “Insert” menu and choose “Paste From Visual Studio”.&lt;/p&gt;
&lt;p&gt;For help with Live Writer see &lt;a rel="nofollow" target="_new" href="http://help.live.com/help.aspx?project=WL_Writer&amp;amp;querytype=keyword&amp;amp;query=qaf&amp;amp;mkt=en-us"&gt;http://help.live.com/help.aspx?project=WL_Writer&amp;amp;querytype=keyword&amp;amp;query=qaf&amp;amp;mkt=en-us&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#8503225</link><pubDate>Wed, 14 May 2008 17:47:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8503225</guid><dc:creator>Jacques</dc:creator><description>&lt;p&gt;Ok, I need a bit of help here.&lt;/p&gt;
&lt;p&gt;I have a Departments table in my dataset and need to load the different departments in the table listed in the department field inside a combobox upon form load procedure.&lt;/p&gt;
&lt;p&gt;How do I do this?&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#8507067</link><pubDate>Thu, 15 May 2008 11:26:27 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8507067</guid><dc:creator>Jacques</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I am trying to add all the items from a table to a combobox.&lt;/p&gt;
&lt;p&gt;The tables I have are&lt;/p&gt;
&lt;p&gt;Access:&lt;/p&gt;
&lt;p&gt;EmployeeNR&lt;/p&gt;
&lt;p&gt;AccessLevel&lt;/p&gt;
&lt;p&gt;Password&lt;/p&gt;
&lt;p&gt;Departments:&lt;/p&gt;
&lt;p&gt;Department&lt;/p&gt;
&lt;p&gt;Functions: &lt;/p&gt;
&lt;p&gt;Function&lt;/p&gt;
&lt;p&gt;Description&lt;/p&gt;
&lt;p&gt;Department&lt;/p&gt;
&lt;p&gt;After I created a form with the FunctionsTableAdapter adding the fields in the form, I added the Department field from the Departments table as a combobox. I need the user to be able to add a new function and just select the department in the combobox.&lt;/p&gt;
&lt;p&gt;If the department does not exist they will add it on another form. I am using VB.Net in VS2008. I have tried the following code on the load procedure of the form and it does not work at all. The combobox just stays empty.&lt;/p&gt;
&lt;p&gt;DepartmentComboBox.DataSource = DataDataSet.Tables(&amp;quot;Departments&amp;quot;)&lt;/p&gt;
&lt;p&gt;DepartmentComboBox.DisplayMember = &amp;quot;Department&amp;quot;&lt;/p&gt;
&lt;p&gt;I am not using the OleDBConnection thing. I added the Data Connection throught the Data Sources. It is a Jet Database(Ms Access)&lt;/p&gt;
&lt;p&gt;If I must use some kind of sql querry, could someone please assist me in doing this? I have looked almost everywhere.&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#8559759</link><pubDate>Thu, 29 May 2008 22:20:54 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8559759</guid><dc:creator>Rob</dc:creator><description>&lt;p&gt;Using the example you provided, how could you:&lt;/p&gt;
&lt;p&gt;1. &amp;nbsp;Only show TerritoryDescriptions that started with the letter B &lt;/p&gt;
&lt;p&gt;and&lt;/p&gt;
&lt;p&gt;2. &amp;nbsp;Sort the results first by the TerritoryDescription and then by the TerritoryID (two column sorting)&lt;/p&gt;
&lt;p&gt;This information will be helpful for me to get past a problem in my project.&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#8559875</link><pubDate>Thu, 29 May 2008 22:50:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8559875</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Rob,&lt;/p&gt;
&lt;p&gt;In the above example you would simply provide a LINQ query and use that as the datasource. Since there is already an association between the Territory and Region in our model we can write:&lt;/p&gt;
&lt;p&gt;Me.RegionBindingSource.DataSource = _&lt;/p&gt;
&lt;p&gt;From t In db.Territories _&lt;/p&gt;
&lt;p&gt;Where t.TerritoryDescription Like &amp;quot;B*&amp;quot; _&lt;/p&gt;
&lt;p&gt;Order By t.TerritoryDescription, t.TerritoryID _&lt;/p&gt;
&lt;p&gt;Select t.Region Distinct&lt;/p&gt;
&lt;p&gt;If there was no association we could still join manually on RegionId in this case:&lt;/p&gt;
&lt;p&gt;Me.RegionBindingSource.DataSource = _&lt;/p&gt;
&lt;p&gt;From r In db.Regions _&lt;/p&gt;
&lt;p&gt;Join t In db.Territories On r.RegionID Equals t.RegionID _&lt;/p&gt;
&lt;p&gt;Where t.TerritoryDescription Like &amp;quot;B*&amp;quot; _&lt;/p&gt;
&lt;p&gt;Order By t.TerritoryDescription, t.TerritoryID _&lt;/p&gt;
&lt;p&gt;Select r Distinct&lt;/p&gt;
&lt;p&gt;This will select regions that have at least one territory that starts with &amp;quot;B&amp;quot;.&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#8559905</link><pubDate>Thu, 29 May 2008 22:58:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8559905</guid><dc:creator>Rob</dc:creator><description>&lt;p&gt;Awesome! &amp;nbsp;Thanks for your quick response. &amp;nbsp;I'll give it a try. &amp;nbsp;:)&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#8563241</link><pubDate>Fri, 30 May 2008 17:17:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8563241</guid><dc:creator>Rob</dc:creator><description>&lt;p&gt;Thanks for your quick help, but maybe I didn't explain properly what I need to do as that didn't produce the expected results.&lt;/p&gt;
&lt;p&gt;For example, lets say you have two tables, one a parent, one a child. &amp;nbsp;You want to be able to use the binding navigator on the parent table to scroll between parent records, and at the same time, the related child table automatically displays the related child records. &amp;nbsp;This part is easy and explained in your helpful blog.&lt;/p&gt;
&lt;p&gt;To take it one step further, what if you wanted to show only a subset of the child table based on the parent record chosen. &amp;nbsp; For example, you want to see all related child records in which a field starts with &amp;quot;B*&amp;quot;. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Your solution, implemented in my code affected the recordset returned by the parent table and didn't do what I needed. &amp;nbsp;Do you think this is possible with linq? &amp;nbsp;Sorry but I am used to the traditional ways of doing this and having trouble making this work with linq. &amp;nbsp;Maybe this is not possible using this technique. &amp;nbsp;Thanks in advance!&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#8566972</link><pubDate>Sat, 31 May 2008 21:20:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8566972</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Rob,&lt;/p&gt;
&lt;p&gt;On the client just handle the PositionChanged event of the Parent BindingSource and then you can filter the child collection. i.e.&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;Private Sub RegionBindingSource_PositionChanged() _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Handles RegionBindingSource.PositionChanged&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;If Me.RegionBindingSource.Position &amp;gt; -1 Then&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Dim region = CType(Me.RegionBindingSource.Current, Region)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me.TerritoriesBindingSource.DataSource = From t In region.Territories _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Where t.TerritoryDescription Like &amp;quot;B*&amp;quot;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;End If&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;End Sub&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#8570224</link><pubDate>Mon, 02 Jun 2008 23:42:30 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8570224</guid><dc:creator>Rob</dc:creator><description>&lt;p&gt;That did the trick! &amp;nbsp;Thanks :)&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#8578775</link><pubDate>Fri, 06 Jun 2008 22:41:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8578775</guid><dc:creator>Rob</dc:creator><description>&lt;p&gt;Lets say you want to implement a custom filter or sort order of the child table as in your answer on May 31 by adding the code to the position changed event. &amp;nbsp;This works great but seems to break the relationship between parent and child for the purpose of adding rows to the child bindingsource. &lt;/p&gt;
&lt;p&gt;Question,&lt;/p&gt;
&lt;p&gt;If adding code like &amp;quot;Me.TerritoriesBindingSource.DataSource = From t In region.Territories order by t.territorydescription&amp;quot;&lt;/p&gt;
&lt;p&gt;to the positionchanged event of the parent binding source for the purpose of sorting, how do you address that this breaks the relationship to the parent bindingsource when adding new records to the child binding source? &amp;nbsp;Is there another way to specify a custom sort or filter for a child bindingsource so that the foreign key in the child bindingsource is automatically set when adding a row to the child?&lt;/p&gt;
&lt;p&gt;I hope that question makes sense!&lt;/p&gt;
&lt;p&gt;Thanks!!&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#8881020</link><pubDate>Wed, 20 Aug 2008 12:56:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8881020</guid><dc:creator>Ron Kochanowski</dc:creator><description>&lt;p&gt;Beth, thanks for all of your insight throughout!&lt;/p&gt;
&lt;p&gt;I've implemented the combobox issue as described and in doing so broke an event that places a variable into a cell within the same DataGridView.&lt;/p&gt;
&lt;p&gt;Using the RowEnter event I have:&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Me.ActivityLogDataGridView.Rows(e.RowIndex).Cells(1).Value() = currentLog&lt;/p&gt;
&lt;p&gt;currentLog is set to the linking LogID value from a corresponding dgv in the same form.&lt;/p&gt;
&lt;p&gt;Prior to getting the combobox to work correctly, this process was working fine. &amp;nbsp;After adding the Sub New() procedure, I get a StackOverflowException pointing back to the RowEnter statement above. &amp;nbsp;Commenting out the statement clears the error and the functionality. &amp;nbsp;Commenting out the Sub New() brings back this functionality, but I loose the combobox.&lt;/p&gt;
&lt;p&gt;Any thoughts?&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#9119924</link><pubDate>Tue, 18 Nov 2008 22:49:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9119924</guid><dc:creator>LJ Brylewski</dc:creator><description>&lt;p&gt;Beth,&lt;/p&gt;
&lt;p&gt;I am currently developing an application for disipline tracking software for the school district I work for. I have been using the video series a lot, and I still haven't been able to find a way to get the last feature working. &lt;/p&gt;
&lt;p&gt;Let me first explain real quick our disipline system. When a students record is added to the database, it adds a new record each time, the first three are Level 1 actions and conseqences, but If the student commits a fourth level 1, I need a way for the program to tell the user to change it to a level two offense. What can I use for this?&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#9383748</link><pubDate>Fri, 30 Jan 2009 00:57:17 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9383748</guid><dc:creator>Erick</dc:creator><description>&lt;p&gt;Beth, thank you for the great information the you have been providing. It has been a huge help to me. I am running into an issue that I can't seem to get past. I have a 2 combobox's that are used to filter a datagridview. Each combobox is data bound to a different datatable that has a relation. I have been able to set a filter on the datagridview to only show rows based on selection of the 2 combobox’s. &amp;nbsp;The Issue I am running into is to get the 2nd combobox to show only distinct values. I set the bindings from the design view and I am using VS2008 Pro. Can you point me in the right direction to accomplish this? Thank you for any help you can provide. &lt;/p&gt;</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#9402357</link><pubDate>Fri, 06 Feb 2009 18:34:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9402357</guid><dc:creator>enrique.prados@a-e.es</dc:creator><description>&lt;p&gt;Hi all,&lt;/p&gt;
&lt;p&gt;How can I change color of a cell in datagridview in this issue:&lt;/p&gt;
&lt;p&gt;- Linking BindingSource with DAtagridView&lt;/p&gt;
&lt;p&gt;- When I add item in BindingSource I want change color of a new row inserted in DatagridView&lt;/p&gt;
&lt;p&gt;Thanks in advance, kind regards&lt;/p&gt;</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#9493208</link><pubDate>Fri, 20 Mar 2009 22:00:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9493208</guid><dc:creator>Waner Michaud</dc:creator><description>&lt;p&gt;Hi Beth,&lt;/p&gt;
&lt;p&gt;I have a form that has a IGPNHDataSet with three Related tables(Registration_Table, Complaint_Table, Offender_Table)&lt;/p&gt;
&lt;p&gt;Relationship as follows: FK_complaint_ID, FK_offender_ID are both in the Registration_Table..&lt;/p&gt;
&lt;p&gt;Registration Table:&lt;/p&gt;
&lt;p&gt;Reg_ID as PK&lt;/p&gt;
&lt;p&gt;Date&lt;/p&gt;
&lt;p&gt;Complaint_ID&lt;/p&gt;
&lt;p&gt;Offender_ID&lt;/p&gt;
&lt;p&gt;Desc&lt;/p&gt;
&lt;p&gt;Nature&lt;/p&gt;
&lt;p&gt;Complaint Table:&lt;/p&gt;
&lt;p&gt;complaint_Id as PK&lt;/p&gt;
&lt;p&gt;lastname&lt;/p&gt;
&lt;p&gt;firstname&lt;/p&gt;
&lt;p&gt;phone&lt;/p&gt;
&lt;p&gt;Offender Table:&lt;/p&gt;
&lt;p&gt;Offender_ID&lt;/p&gt;
&lt;p&gt;lastname&lt;/p&gt;
&lt;p&gt;firstname&lt;/p&gt;
&lt;p&gt;phone&lt;/p&gt;
&lt;p&gt;etc..&lt;/p&gt;
&lt;p&gt;Above is my tables structure.&lt;/p&gt;
&lt;p&gt;On the form, I drag all the info for all three tables..&lt;/p&gt;
&lt;p&gt;Onload, I get all the records from the tables..&lt;/p&gt;
&lt;p&gt;when i click on NEW to do a new registration which will include new complainant and offender, the fields from the regitration table is cleared and i can enter new record&lt;/p&gt;
&lt;p&gt;but for complainant and offender, no action is taking, i cannot enter new info for them.&lt;/p&gt;
&lt;p&gt;Can you please guide me on what to do and need to save/update the records&lt;/p&gt;
&lt;p&gt;if need be, send me some guidances at wnmichaud@yahoo.com&lt;/p&gt;
&lt;p&gt;thanks..&lt;/p&gt;</description></item><item><title>Data Binding WPF Lookup Combobox Values to EF Entities</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#9582646</link><pubDate>Fri, 01 May 2009 20:18:53 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9582646</guid><dc:creator>Beth Massi - Sharing the goodness that is VB</dc:creator><description>&lt;p&gt;It’s extremely common to have to hook up lookup tables on your data entry forms in order to populate&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#9770008</link><pubDate>Wed, 17 Jun 2009 21:13:16 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9770008</guid><dc:creator>Kevin Burton</dc:creator><description>&lt;p&gt;I brought up the Data Sources window and I added some data sources and I don't get the equivalent of RegionBindingSource (or any code for that matter).&lt;/p&gt;
&lt;p&gt;What am I doing wrong?&lt;/p&gt;</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#9820686</link><pubDate>Tue, 07 Jul 2009 00:20:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9820686</guid><dc:creator>Jerry</dc:creator><description>&lt;p&gt;I have learned a lot from your blogs and videos. &amp;nbsp;Sorry to dig up an old post, but just getting into LINQ to SL on Winforms. &amp;nbsp;Been using it on webforms, mostly MVC.&lt;/p&gt;
&lt;p&gt;The question I have is this, how can I sort the data prior to binding it to the combobox? &amp;nbsp;I want to sort on customername (text) and customerid will be the value. &amp;nbsp;&lt;/p&gt;</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#9823038</link><pubDate>Tue, 07 Jul 2009 21:37:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9823038</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Kevin,&lt;/p&gt;
&lt;p&gt;When you drag-drop the tables from the data source window onto the Winform it will create the BindingSources for you on the form in the component tray. Take a look at these videos: &lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/vbasic/bb725824.aspx"&gt;http://msdn.microsoft.com/en-us/vbasic/bb725824.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://msdn.microsoft.com/en-us/vbasic/cc138241.aspx"&gt;http://msdn.microsoft.com/en-us/vbasic/cc138241.aspx&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#9823095</link><pubDate>Tue, 07 Jul 2009 22:52:18 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9823095</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Jerry,&lt;/p&gt;
&lt;p&gt;You can just write a LINQ query to order the collection you want to bind to. For instance in the above example if I wanted to sort the Regions on RegionDescription field then I could do this:&lt;/p&gt;
&lt;p&gt;Me.RegionComboBox.DataSource = Nothing&lt;/p&gt;
&lt;p&gt;Dim sortedRegionList = (From r In db.Regions _&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Order By r.RegionDescription).ToList()&lt;/p&gt;
&lt;p&gt;Me.RegionBindingSource.DataSource = sortedRegionList&lt;/p&gt;
&lt;p&gt;Me.RegionComboBox.DataSource = Me.RegionBindingSource&lt;/p&gt;
&lt;p&gt;HTH,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#9836416</link><pubDate>Fri, 17 Jul 2009 05:26:14 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9836416</guid><dc:creator>Jack Webb</dc:creator><description>&lt;p&gt;Sorry for the delayed response, I'm in a different time zone! &amp;nbsp;I saw you post re using Live Writer to paste VS code which includes formatting (see below).&lt;/p&gt;
&lt;p&gt;I now wonder how you also paste dialog boxes as well.&lt;/p&gt;
&lt;p&gt;tia&lt;/p&gt;
&lt;p&gt;jjw&lt;/p&gt;</description></item><item><title>re: Related Data Binding and ComboBoxes with LINQ to SQL</title><link>http://blogs.msdn.com/bethmassi/archive/2008/02/06/related-data-binding-and-comboboxes-with-linq-to-sql.aspx#9837590</link><pubDate>Fri, 17 Jul 2009 19:16:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9837590</guid><dc:creator>Beth Massi</dc:creator><description>&lt;p&gt;Hi Jack, &lt;/p&gt;
&lt;p&gt;I use live writer for everything. I just paste screen shots into the posts and it handles uploading them as pictures. &lt;/p&gt;
&lt;p&gt;Cheers,&lt;/p&gt;
&lt;p&gt;-B&lt;/p&gt;
</description></item></channel></rss>