简体   繁体   English

重载解析失败,因为没有可访问的“ DataBind”最特定于这些参数

[英]overload resolution failed because no accessible 'DataBind' is most specific for these arguments

I am getting this error 'overload resolution failed because no accessible 'DataBind' is most specific for these arguments' below is the code I am using. 我收到此错误“过载解析失败,因为下面这些是我正在使用的代码,因为没有可访问的” DataBind”最特定于这些参数”。

    Private Overloads Sub DataBind(ByVal iPageIndex As Integer) 
     //do some thing 
    End Sub

    Protected Overridable Sub DataBind(raiseondatabinding as Boolean)
        //Do some thibg
    End Sub

    Private Sub btnSearch_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSearch.Click
            DataBind(Nothing) //this is where I am getting error
    End Sub

Any help would be appropriated. 任何帮助都会被挪用。

Thanks, 谢谢,

Pradeep 普拉迪普

It doesn't know which version of DataBind you're trying to use, because Nothing is convertible to both Boolean and Integer . 它不知道您要使用哪个版本的DataBind ,因为Nothing可以同时转换为BooleanInteger You could either use a variable for this: 你可以使用一个变量:

Private Sub btnSearch_Click(ByVal sender As Object, _
                            ByVal e As ImageClickEventArgs) _
                            Handles btnSearch.Click
    Dim x As Integer = Nothing
    DataBind(x)
End Sub

or just specify 0 or False as the argument: 或者只指定0False作为参数:

Private Sub btnSearch_Click(ByVal sender As Object, _
                            ByVal e As ImageClickEventArgs) _
                            Handles btnSearch.Click
    DataBind(False)
End Sub

Adjust depending on which version you actually wanted to call. 根据您实际要呼叫的版本进行调整。 Like the compiler, I can't tell what you intended :) 像编译器一样,我无法说出您的意图:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM