-
Oct 26th, 2020, 02:17 PM
#1
Thread Starter
Member
[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
-
Oct 26th, 2020, 02:30 PM
#2
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
-
Oct 26th, 2020, 06:50 PM
#3
Thread Starter
Member
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.
-
Oct 26th, 2020, 06:56 PM
#4
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.
-
Oct 26th, 2020, 07:03 PM
#5
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."
-
Oct 26th, 2020, 07:19 PM
#6
Thread Starter
Member
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
-
Oct 26th, 2020, 07:22 PM
#7
Thread Starter
Member
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.
-
Oct 26th, 2020, 07:24 PM
#8
Thread Starter
Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|