none
Using LINQ to its potential RRS feed

  • General discussion

  • Hello again,

    I have skimmed through a few chapters, and its paragraphs just to grasp my knowledge of what LINQ is all about.

    Here I have the code snippet below...

    Public Class Form1
        Private Sub ListOfNamesBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles ListOfNamesBindingNavigatorSaveItem.Click
            Me.Validate()
            Me.ListOfNamesBindingSource.EndEdit()
            Me.TableAdapterManager.UpdateAll(Me.NamesDBBackupOneDataSet)
    
        End Sub
    
        Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            'TODO: This line of code loads data into the 'NamesDBBackupOneDataSet.ListOfNames' table. You can move, or remove it, as needed.
            Me.ListOfNamesTableAdapter.Fill(Me.NamesDBBackupOneDataSet.ListOfNames)
    
        End Sub
    
        Private Sub btnAddresses_Click(sender As Object, e As EventArgs) Handles btnAddresses.Click
            Form2.Show()
    
        End Sub
    End Class
    
    
    Imports System.Linq
    
    Public Class Form2
        Private Sub TblAddressesBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles TblAddressesBindingNavigatorSaveItem.Click
            Me.Validate()
            Me.TblAddressesBindingSource.EndEdit()
            Me.TableAdapterManager.UpdateAll(Me.NamesDBBackupOneDataSet)
    
        End Sub
    
        Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            'TODO: This line of code loads data into the 'NamesDBBackupOneDataSet.tblAddresses' table. You can move, or remove it, as needed.
            Me.TblAddressesTableAdapter.Fill(Me.NamesDBBackupOneDataSet.tblAddresses)
    
        End Sub
    
        Private Sub FillByToolStripButton_Click(sender As Object, e As EventArgs) Handles FillByToolStripButton.Click
    
            Dim FilteredByNameID = From tblAddresses In Me.NamesDBBackupOneDataSet.tblAddresses
                                   Where tblAddresses.NameID = 1
                                   Select tblAddresses.AddressID, tblAddresses.Address, tblAddresses.NameID
    
            Me.TblAddressesBindingSource.DataSource = FilteredByNameID    'This parameter is not implemented, and it will cause errors at runtime 
    
    
        End Sub
    End Class

    I could not get any screenshots; even though, I have the following two public classes.

    In form 1:

    There are three text box controls, one button control, and a binding navigator.

    In form 2:

    There are three text box controls, one button control, a binding navigator, and a tool strip button.

    Here are the two tables.

    Database Name: NamesDBBackup

    Tables:

    ListOfNames                        tblAddresses

    PK   NameID                     PK AddressID

           LastName                       Address

           FirstName                  FK NameID

    PK = Primary Key    FK = Foreign Key

    Any user who wishes to copy and paste, as well as, to create their own controls as it is stated above is okay.

    I am winning to provide any feedback from any user within this thread.

    Regards,

    JohnDBCTX 


    jp

    Friday, July 20, 2018 9:29 PM

All replies

  • I meant I am willing to provide any feedback from any user within this thread.

    not winning.

    I do apologize for my fast but careless typing.


    jp

    Friday, July 20, 2018 9:31 PM
  • Hi

    Thank you for your sharing in the forum activities.

    Best Regards,

    Alex


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, July 23, 2018 5:54 AM