DLINQ Combo Box in Datagridview
-
Good Morning I have a query related to DLINQ. I have a datagridview with a combo box in the one field. The user may select categories from the drop down box. Only one category can exist (no duplicates). What I want to do is using LINQ to get a new dataset containing all the records that is not selected (by the datagridview) and the value of the current selected one and gives that as a datasource for the combo box. This way the user doesn’t have multiple options that they shouldn’t select anyway but only the ones they can select. I have problems defining a query to get the data. Has anyone tried doing this before? I have played around and this is what I have currently but it doesn't include the current row aswell. (I am new to LINQ and don't understand the full meaning of the queries - any one can translate it in normal word will great :-D - The code snippet below is by looking at examples)
Dim query = From t1 In dataset1.tblLookup.AsEnumerable() _
Group Join r In dataset2.tblMainDisplayDGV.AsEnumerable() _
On r.Field(Of String)("CommonField") Equals t1.Field(Of String)("CommonField") _
Into x = Group _
From r2 In x.DefaultIfEmpty() _
Where r2 Is Nothing _
Select t1Regards, Christiaan