重载决策失败,因为没有可访问的'DataBind'对这些参数最具体

时间:2010-11-30 09:53:36

标签: .net vb.net

我收到此错误'重载解析失败,因为没有可访问的'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

任何帮助都会被挪用。

谢谢,

与Pradeep

1 个答案:

答案 0 :(得分:2)

它不知道您尝试使用的DataBind版本,因为Nothing可转换为BooleanInteger。您可以使用变量:

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

或只指定0False作为参数:

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

根据实际想要呼叫的版本进行调整。像编译器一样,我无法分辨你的意图:)