By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,247 Members | 1,273 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,247 IT Pros & Developers. It's quick & easy.

Class Declaration Problem with Inherits and Implements

P: n/a
Hi,

I have the following class declaration and the ide is giving the following
errors.

Interface 'System.Web.UI.IPostBackDataHandler' is already implemented by
base class 'System.Web.UI.HtmlControls.HtmlInputRadioButton'.

'System.Web.UI.IPostBackDataHandler.LoadPostData' is already implemented by
base class 'System.Web.UI.HtmlControls.HtmlInputRadioButton' and cannot be
implemented again.

Public Class ParticipantRadioButton
Inherits System.Web.UI.HtmlControls.HtmlInputRadioButton
Implements IPostBackDataHandler
Private Function LoadPostData(ByVal postDataKey As String, _
ByVal postCollection As NameValueCollection) As Boolean
Implements IPostBackDataHandler.LoadPostData

End Function

Nov 21 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
I can't believe nobody knows how to do this. Anyhelp is appreciated.
Nov 21 '05 #2

P: n/a
It's telling you that the base class already implements the interface.
There is no need for you to do it again.

Nov 21 '05 #3

P: n/a
Why does C# allow you Implement an Interface that the Inherited class is
already implementing and VB.Net does not?

This pisses me of there has to be another way to do this by using a generic
control or something .
Nov 21 '05 #4

P: n/a
Chris,
VB.NET 2002 & 2003 (.NET 1.0 & 1.1) does not allow a derived class to
implement the same interface as a base class (although corresponding
versions of C# does, remember VB.NET is not C#, nor is C# VB.NET)...

I'm not certain as to the reason for the restriction...

My understanding is that VB 2005 (.NET 2.0) will allow a derived class to
implement the same interface as a base class. Unfortunately I don't have a
reference handy, nor my VPC handy to verify...

Hope this helps
Jay

"Chris Lane" <Ch*******@discussions.microsoft.com> wrote in message
news:BE**********************************@microsof t.com...
| Hi,
|
| I have the following class declaration and the ide is giving the following
| errors.
|
| Interface 'System.Web.UI.IPostBackDataHandler' is already implemented by
| base class 'System.Web.UI.HtmlControls.HtmlInputRadioButton'.
|
| 'System.Web.UI.IPostBackDataHandler.LoadPostData' is already implemented
by
| base class 'System.Web.UI.HtmlControls.HtmlInputRadioButton' and cannot be
| implemented again.
|
| Public Class ParticipantRadioButton
| Inherits System.Web.UI.HtmlControls.HtmlInputRadioButton
| Implements IPostBackDataHandler
|
|
| Private Function LoadPostData(ByVal postDataKey As String, _
| ByVal postCollection As NameValueCollection) As Boolean
| Implements IPostBackDataHandler.LoadPostData
|
| End Function
|
|
|
Nov 21 '05 #5

P: n/a
I know that but C# lets you do it so you can implement your own version of
the interfaces method.

HtmlInputRadioButton.IPostBackDataHandler.LoadPost Data MethodSee Also
HtmlInputRadioButton Class | HtmlInputRadioButton Members |
System.Web.UI.HtmlControls Namespace | Managed Extensions for C++ Programming
Language
C#

C++

JScript

Visual Basic

Show All
This member supports the .NET Framework infrastructure and is not intended
to be used directly from your code.

[Visual Basic]
Private Function LoadPostData( _
ByVal postDataKey As String, _
ByVal postCollection As NameValueCollection _
) As Boolean Implements IPostBackDataHandler.LoadPostData

[C#]
bool IPostBackDataHandler.LoadPostData(
string postDataKey,
NameValueCollection postCollection
);

It's private for
"Chris Dunaway" wrote:
It's telling you that the base class already implements the interface.
There is no need for you to do it again.

Nov 21 '05 #6

P: n/a
Jay,

"Jay B. Harlow [MVP - Outlook]" <Ja************@tsbradley.net> schrieb:
My understanding is that VB 2005 (.NET 2.0) will allow a derived class to
implement the same interface as a base class. Unfortunately I don't have a
reference handy, nor my VPC handy to verify...


Yes, VB 2005 (August CTP) allows interface re-implementation.

\\\
Public Interface IGoo
Sub Bla()
End Interface

Public Class Bar
Implements IGoo

Public Sub Bla() Implements IGoo.Bla
'
End Sub
End Class

Public Class FooBar
Inherits Bar
Implements IGoo

Public Overloads Sub Bla() Implements IGoo.Bla
'
End Sub
End Class
///

There will be a warning given on 'Implements IGoo.Bar' of class 'FooBar'
("Warning: 'IGoo.Bla' is already implemented by the base class 'Bar'.
Re-implementation of sub assumed").

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 21 '05 #7

P: n/a
Thanks, Jay and Herfried. I guess I am SOL unless I use C# to do this for now.

Nov 21 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.