Last post Oct 16, 2008 11:50 AM by Chaplain Doug
Oct 01, 2008 07:24 PM|Chaplain Doug|LINK
VWD 2008 Express. Visual Basic.
I am converting some of the code from the SampleWebSite in the AJAX Controls Toolkit. I converted the following C# code using an online coversion tool:
public partial class DefaultMaster_Default : MasterPage, IContentPlaceHolders
public IList GetContentPlaceHolders()
Which resulted in the following VB code:
Public Partial Class DefaultMaster_Default
Public Function GetContentPlaceHolders() As IList
When I try to build the resulting page, I get the following error:
Error 9 Class 'DefaultMaster_Default' must implement 'Function GetContentPlaceHolders() As System.Collections.IList' for interface 'IContentPlaceHolders'
Any idea what I need to do to fix this "error." Thanks for the help.
Oct 01, 2008 07:37 PM|vcsjones|LINK
I believe you need to add "Implements IContentPlaceHolders.GetContentPlaceHolders" after As IList of your function, like this:
Partial Public Class DefaultMaster_Default
Public Function GetContentPlaceHolders() As IList Implements IContentPlaceHolders.GetContentPlaceHolders
Oct 01, 2008 08:04 PM|Chaplain Doug|LINK
Thanks Kevin. That seemed to do it. Why are there now two "Implements" for IContentPlace Holders? I am confused about just what "Implements" does?
Oct 01, 2008 08:24 PM|David Anton|LINK
The 'Implements' near the top just says that your class will implement the interface.
In VB, the 'Implements' is also required on every method which satisfies the interface's requirements. You are required to have a method implementing every method of the interface (an interface is like a contract), and VB requires that you explicitly state
this for each method. If you want you can use a different method name (unlike C#) since VB only looks at the 'Implements' clause for the method and verifies that the method parameters and return type matches the interface method.
Oct 16, 2008 11:37 AM|mineshchristian|LINK
Which Conversion tool did you use to convert from C# to Classic Visual Basic?
Any other free tools?
Oct 16, 2008 11:44 AM|Chaplain Doug|LINK
I used the free converter at:
Oct 16, 2008 11:48 AM|mineshchristian|LINK
But I am looking for conversion to Classis VB (say VB 6) and not the VB.NET. Going bakwards!!
Oct 16, 2008 11:50 AM|Chaplain Doug|LINK
Sorry I don't have a link for that.