Implementing IPostBackDataHandler in a custom web control with VB.NET

Discussion in 'ASP .Net Building Controls' started by Andrew Dawson, Aug 9, 2004.

  1. I have created a custom class with Visual Basic that inherits from the
    drop down list web control. In order to update the value properly, I
    have tried to implement IPostBackDataHandler, but receive the
    following error message:

    Interface 'System.Web.UI.IPostBackDataHandler' is already implemented
    by base class 'System.Web.UI.WebControls.DropDownList'.

    My code is as follows:

    Imports System.Web.UI

    Public Class CodeDescDropDown
    Inherits System.Web.UI.WebControls.DropDownList
    Implements INamingContainer
    Implements IPostBackDataHandler

    Protected Overrides Sub Render(ByVal output as
    System.Web.UI.HtmlTextWriter)
    Mybase.Render(output)
    End Sub

    'Class implementation

    End Class

    For some reason, this error is not created if I use C# to write the
    class, but I really want to use VB. Please let me know if you need
    more information. Thanks for the help.
     
    Andrew Dawson, Aug 9, 2004
    #1
    1. Advertisements

  2. Andrew Dawson

    Teemu Keiski Guest

    Hi,

    this is a lack of feature in VB.NET. It doesn't allow you to reimplement an
    interface on derived class, but C# does.

    See here:
    http://weblogs.asp.net/fbouma/archive/2003/11/12/37199.aspx

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist
    http://blogs.aspadvice.com/joteke

    "Andrew Dawson" <> wrote in message
    news:...
    > I have created a custom class with Visual Basic that inherits from the
    > drop down list web control. In order to update the value properly, I
    > have tried to implement IPostBackDataHandler, but receive the
    > following error message:
    >
    > Interface 'System.Web.UI.IPostBackDataHandler' is already implemented
    > by base class 'System.Web.UI.WebControls.DropDownList'.
    >
    > My code is as follows:
    >
    > Imports System.Web.UI
    >
    > Public Class CodeDescDropDown
    > Inherits System.Web.UI.WebControls.DropDownList
    > Implements INamingContainer
    > Implements IPostBackDataHandler
    >
    > Protected Overrides Sub Render(ByVal output as
    > System.Web.UI.HtmlTextWriter)
    > Mybase.Render(output)
    > End Sub
    >
    > 'Class implementation
    >
    > End Class
    >
    > For some reason, this error is not created if I use C# to write the
    > class, but I really want to use VB. Please let me know if you need
    > more information. Thanks for the help.
     
    Teemu Keiski, Aug 12, 2004
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Showjumper

    Re: Help w/ IPostBackDataHandler

    Showjumper, Jun 24, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    1,709
    Showjumper
    Jun 24, 2003
  2. One Handed Man \( OHM - Terry Burns \)

    Custom Control & System.Web.UI.IPostBackDataHandler.LoadPostData

    One Handed Man \( OHM - Terry Burns \), Jun 17, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    2,058
    One Handed Man \( OHM - Terry Burns \)
    Jun 17, 2004
  3. Francois
    Replies:
    6
    Views:
    2,956
    Joe Fallon
    Dec 5, 2004
  4. z f
    Replies:
    1
    Views:
    8,460
    =?Utf-8?B?RFdT?=
    Mar 1, 2006
  5. Henri
    Replies:
    1
    Views:
    246
    MasterGaurav
    May 20, 2005
Loading...

Share This Page