Question about Implementing VB 6.0 Interface in vb.net

Question about Implementing VB 6.0 Interface in vb.net

Post by Yatin Bhut » Sat, 03 Apr 2004 09:56:06


Hi,

I have an interface in vb 6.0. It has a property set member, which takes a
parameter by reference. When I try to implement this interface in my vb.net
project it gives me an error saying that "cannot implement property set
because there is no matching property on interface". I think .NET does not
allow parameter to be passed ByRef in property statements.

here is my property set statement in vb 6.0 interface called IName

Property Set Name(ByRef objName as object)

End Property

VB.NET code looks like this

Public WriteOnly Property Name() as System.IntPtr implements IName.Name
Set (ByVal value as System.IntPtr)

end set
End Property

There is an underline below IName.Name. When I put my mouse over it then it
says "Cannot implement IName.Name because there is no matching property on
Interface IName". I tried changing the System.IntPtr to System.Object but it
gives the same result. I cannot change vb 6.0 interface to accept parameter
ByVal instead of ByRef because then, I have to change all other existing
components that already are implementing this interface.

Your help is appreciated.

Thanks
 
 
 

1. VB.NET Newbie Question - VB.NET Forms and Media Player

2. How implement VB.NET interface event in managed c++?

I have a VB.NET interface that my managed C++ code is to implement. I
seem to
be stuck implementing an event defined in that interface. Does anyone
have a
simple code snippet that will show me the basics of what I need to
implement?
I've seen all the MSDN articles on implementing events in managed C++
and
I've gotten events to work without issue when implementing all the
constructs
myself. I fail miserably when trying to correctly implement an event
defined
in a VB.NET interface. It's not clear what's defined implicitly and
explicitly. I need your help.

Let's say we have a trivial VB.NET interface defined (my syntax may be
off):

Public Interface ISomethingTrivial
Sub Func1()
Event Loaded()
End Interface

On the managed C++ side I would have:

__gc class MySomethingTrivial : public ISomethingTrivial
{
public:
// Constructor
// Destructor

void Func1() { /* Do something here */ }

// How implement the event here???
}

If I go ahead and implement the add_EventName() remove_EventName()
events I
get errors about multiple methods being defined. So I get the gist that
these
are created "behind the scenes" for me at compile time. I don't know
how to
define the raise_EventName() appropriately as I don't know what else is
under
the covers that I need to call. Each time I attempt to implement the
event
(incorrectly) I can successfully compile my managed C++ class, but when
I go
to instantiate an instance of it in my VB code I get "Cannot call New
on a
class listed as MustOverride". I assume I will see this until I
correctly
implement the event. Someone out there must have experience with
this....

Many thanks for your help. - Brett

3. VB.NET OOP Interface / Implements clarification .. Thank you!

4. Dll from VB.NET to VB 6.0

5. Using VB.NET object in VB 6.0 project

6. How can I use the same objects in VB 6.0 as in VB.NET?

7. Image List VB 6.0 versus VB.net

8. Any built-in function in VB.NET (or VB 6.0) for creating .DBF file?

9. Compiling a converted form from VB 6.0 to VB.NET 2003

10. Printing-Codes Conversion from VB 6.0 to VB.NET

11. TreeView Migration from VB 6.0 to VB.NET

12. MS Access: VB 6.0 vs. VB.net & Multiple Users

13. Convert VB 6.0 to VB.NET, Problem with Wizard

14. Problem compiling vb.net to be used by a VB 6.0 App

15. VB.NET equiv to VB 6.0 "SetFocus()"