none
[Resolved] FillToolStripButton_Click; what does this do? RRS feed

  • Question

  • I have this code and I don't remember what it does.

    Does anybody have a clue?

    Private Sub FillToolStripButton_Click(sender As Object, e As EventArgs)
            Try
                Me.ProjectsTableAdapter.Fill(Me.EVC_ProjectsDataSet.Projects)
            Catch ex As System.Exception
                System.Windows.Forms.MessageBox.Show(ex.Message)
            End Try
    
        End Sub


    • Edited by wk89 Sunday, May 5, 2019 6:38 AM
    Saturday, May 4, 2019 8:22 AM

Answers

  • Well from what is shown you have a TableAdapter called ProjectsTableAdapter which is populating Projects DataTable in EVC_ProjectsDataSet.

    A TableAdapter component generally resides on a form and is used to populate a DataGridView or DataGridView and one or more controls via DataBinding or one or more controls w/o a DataGridView via DataBindings.

    The TableAdapter component gets data from a database table(s) usually in form load

    Usually a Try/Catch is not required.

    So with that it appears that if you have followed the above then you are repopulating the DataTable in the DataSet. Usually this is done with a Fill method that filters data but that seems not the case here as a custom Fill method usually accepts a value to use in a WHERE condition in the query for the Fill method.

    I may be off in the why you are doing this but spot on with the explanation of the TableAdapter. 


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by wk89 Sunday, May 5, 2019 6:37 AM
    Saturday, May 4, 2019 1:27 PM
    Moderator

All replies

  • Well from what is shown you have a TableAdapter called ProjectsTableAdapter which is populating Projects DataTable in EVC_ProjectsDataSet.

    A TableAdapter component generally resides on a form and is used to populate a DataGridView or DataGridView and one or more controls via DataBinding or one or more controls w/o a DataGridView via DataBindings.

    The TableAdapter component gets data from a database table(s) usually in form load

    Usually a Try/Catch is not required.

    So with that it appears that if you have followed the above then you are repopulating the DataTable in the DataSet. Usually this is done with a Fill method that filters data but that seems not the case here as a custom Fill method usually accepts a value to use in a WHERE condition in the query for the Fill method.

    I may be off in the why you are doing this but spot on with the explanation of the TableAdapter. 


    Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.

    NuGet BaseConnectionLibrary for database connections.

    StackOverFlow
    profile for Karen Payne on Stack Exchange

    • Marked as answer by wk89 Sunday, May 5, 2019 6:37 AM
    Saturday, May 4, 2019 1:27 PM
    Moderator
  • So in order to trigger this, I should have a button called FillToolStripButton, but I can't seem to find it.

    I guess it could be a Event no longer in use.


    Sunday, May 5, 2019 5:00 AM
  • I believe the button has been removed and the Event is just left behind, so I can safely delete it.

    Case Closed

    Sunday, May 5, 2019 6:38 AM