Results 1 to 8 of 8

Thread: [RESOLVED] Overload error

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2019
    Posts
    57

    Resolved [RESOLVED] Overload error

    Getting an overload resolution failed

    Overload resolution failed because no accessible 'Fill' can be called with these arguments:
    'Public Overrides Function Fill(dataSet As DataSet) As Integer': Value of type 'DataGridTableStyle' cannot be converted to 'DataSet'.
    'Public Overloads Function Fill(dataTable As DataTable) As Integer': Value of type 'DataGridTableStyle' cannot be converted to 'DataTable'.
    Code:
    Imports MySql.Data.MySqlClient
    Public Class Movie_Player
        Private Sub Movie_Player_Load(sender As Object, e As EventArgs) Handles MyBase.Load
    
            Dim connection As New MySQLConnection("datasource=localhost;port=3306;username=root;password=")
            Dim adapter As New MySqlDataAdapter("SELECT `movietitle`, `movieloc` FROM `movies` order by `movietitle`", connection)
            Dim table As New DataGridTableStyle()
    
            adapter.Fill(table) <-- Stating here is the error
    
            MovieBox.DataSource = table
    
            MovieBox.DisplayMember = "movietitle"
            MovieBox.ValueMember = "movieloc"
            MovieBox.SelectedItem = Nothing
    
        End Sub
        Private Sub MovieBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles MovieBox.SelectedIndexChanged
            xmasMOVIES.URL = CStr(MovieBox.SelectedValue)
            xmasMOVIES.Ctlcontrols.play()
        End Sub

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Overload error

    There are different versions of Fill that accept different parameters. As the message is telling you, the parameter can either be a DataSet or a DataTable.

    I'm assuming this will do what you want:
    Code:
    Dim table As DataTable

  3. #3

    Thread Starter
    Member
    Join Date
    Nov 2019
    Posts
    57

    Re: Overload error

    Doing something wrong. Not sure what. I copied the code from an old program I had written in to the new one (No more than a month old and changed nothing but getting the error. Will need to dig more to see what I am missing.

  4. #4
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Overload error

    I get that sometimes error messages can be a bit confusing or obtuse. This isn't one of those instances.

    The message couldn't be clearer. You are calling the Fill function and passing in the wrong type. It is essentially saying you are trying to put a square peg in a round hole.

    si pointed out the obvious fix. You are declaring your "table" variable incorrectly.

  5. #5
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Overload error

    From https://docs.microsoft.com/en-us/dot...tframework-4.8

    "The DataGridTableStyle is a class that represents the drawn grid only. This grid should not be confused with the DataTable class, which is a possible source of data for the grid. Instead, the DataGridTableStyle strictly represents the grid as it is painted in the control."

  6. #6

    Thread Starter
    Member
    Join Date
    Nov 2019
    Posts
    57

    Re: Overload error

    The primary reference "MySql.Data, Version=8.0.21.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d, processorArchitecture=MSIL" could not be resolved because it has an indirect dependency on the assembly "Google.Protobuf, Version=3.6.1.0, Culture=neutral, PublicKeyToken=a7d26565bac4d604" which was built against the ".NETFramework,Version=v4.5" framework. This is a higher version than the currently targeted framework ".NETFramework,Version=v4.0,Profile=Client".
    New nightmare

  7. #7

    Thread Starter
    Member
    Join Date
    Nov 2019
    Posts
    57

    Re: Overload error

    Current working in stand along program I created:

    Code:
    Imports MySql.Data.MySqlClient
    Public Class Movie_Player
        Public conn As New MySqlConnection("server=localhost; user=root; password=mysql; database=xmas;")
    
        Private Sub PlayToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles PlayToolStripMenuItem.Click
            xmasMOVIE.Ctlcontrols.play()
        End Sub
    
        Private Sub PauseToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles PauseToolStripMenuItem.Click
            xmasMOVIE.Ctlcontrols.pause()
        End Sub
    
        Private Sub StopToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles StopToolStripMenuItem.Click
            xmasMOVIE.Ctlcontrols.stop()
        End Sub
    
        Private Sub Movie_Player_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Dim da As New MySqlDataAdapter("SELECT `movietitle`, `movieloc` FROM `movies` order by `movietitle`", conn)
            Dim dt As New DataTable
            da.Fill(dt)
            MovieBox.DisplayMember = "movietitle"
            MovieBox.ValueMember = "movieloc"
            MovieBox.DataSource = dt
            MovieBox.SelectedItem = Nothing
        End Sub
    
        Private Sub CloseToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles CloseToolStripMenuItem.Click
            Me.Close()
        End Sub
    
        Private Sub MovieBox_SelectedIndexChanged(sender As Object, e As EventArgs) Handles MovieBox.SelectedIndexChanged
            xmasMOVIE.URL = CStr(MovieBox.SelectedValue)
            xmasMOVIE.Ctlcontrols.play()
        End Sub
    
        Private Sub HScrollBar1_Scroll(sender As Object, e As ScrollEventArgs) Handles HScrollBar1.Scroll
            xmasMOVIE.settings.volume = HScrollBar1.Value
        End Sub
    End Class
    Copied this exactly in to a new program I am working on as I wanted to include it as an addon but started spitting out all those errors.

  8. #8

    Thread Starter
    Member
    Join Date
    Nov 2019
    Posts
    57

    Re: Overload error

    OMG I am an idiot. Realized the issue after I posted it. The the code I was adding to was 4.0 and not 4.7. Sorry.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width