Property implementations must have the appropriate ReadOnly or WriteOnly specifications.

I have an interface defined in the idl file and trying to convert a vb6 project to vb.net.

The conversion created an interop from tlb of this idl, and in vs2010 it complains that the property is not executing (as shown below). Does anyone know why? I even deleted the implementation and got vs2010 to restore the stub and still errors.

interface example in idl ..

[ uuid(...), version(2.0), dual, nonextensible, oleautomation ] interface IExampleInterface : IDispatch { ... [id(3), propget] HRESULT CloseDate ([out, retval] DATE* RetVal); [id(3), propput] HRESULT CloseDate ([in] DATE* InVal); } 

Class VB.Net ...

 <System.Runtime.InteropServices.ProgId("Project1_NET.ClassExample")> Public Class ClassExample Implements LibName.IExampleInterface Public Property CloseDate As Date Implements LibName.IExampleInterface.CloseDate Get Return mDate End Get Set(value As Date) mDate = value End Set End Property 
+4
source share
1 answer

The type of the DATE argument is the problem. It is not DateTime or Date, it is Double . The announcement is in the WTypes.h SDK header file, line # 1025 for v7.1:

  typedef double DATE; 

So, fix your property by declaring it "Double" and convert back and forth as needed:

 Public Property CloseDate As Double Implements LibName.IExampleInterface.CloseDate Get Return mDate.ToOADate End Get Set(value As Date) mDate = DateTime.FromOADate(value) End Set End Property 
+2
source

Source: https://habr.com/ru/post/1447145/


All Articles