473,386 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

How the order of Get/Set property is determined?

The definition of a read/write property in an interface is similar to the following:

Public Interface EiDuty
Property Key() As String
End Interface

If I would like to generate a TLB out of the interface, how does the tool tlbexp knows what to export first? The get property or the set property goes first??

This is the tlb from the previous code:
[id(0x40030000), propput]
HRESULT Key([in] BSTR pRetVal);
[id(0x40030000), propget]
HRESULT Key([out, retval] BSTR* pRetVal);

In some other cases, I get the opposite:
[id(0x40030000), propget]
HRESULT Label([out, retval] BSTR* pRetVal);
[id(0x40030000), propput]
HRESULT Label([in] BSTR pRetVal);

Is there anything to force the order of get and set? Something similar to C# where in C# I explicitly specify the order like this:

string Key { get; set; }

or if i want to i could write it like this:

string Key { set; get; }

Any advice?

Nov 20 '05 #1
3 1398
Hi,

I wonder why you need to specified the order of the get and set in a
property?
Do you have any concern about the issue?
Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #2
Thanks Peter,

I am trying to generate a TLB from .NET that matches another TLB. The client (that uses Virtual Table to access the functions in the COM) needs the properties and functions to be in the exact order. So, having the get and set functions flipped in the typelib will make the client unhappy and crash.

I can specify the order of get/set in the class implementation and if i generated the interface directly from the class, it will work fine. But I would rather specify an explicit interface definition.

Also I can write two properties with different names as the following:
<DispId(&H68030002)> WriteOnly Property SetLabel() As String
<DispId(&H68030002)> ReadOnly Property GetLabel() As String
Notice that I set the DispId to be the same, but since these are differnet properties, the tool tlbexp will generate different DispId(s) and won't use the one I supplied. In this solution, clients that use the Virtual Table will work fine but the clients that use Dispatch ID won't work.

What really bugs me is that the order is not always the same when declaring the read/write property in the interface body.

Any suggestions, advice, comments is highly appreciated..

Thanks,

Nov 20 '05 #3
Hi Hani,

Based on my researching, I think we can not do this in VB.NET. I think the
problem is more concern about how the vbc compile the vb.net code into il
language. As to the tool, it is just export the tlb from the assembly which
has already been il language.

As a workaround I think we may try to write C# interface and then implement
it in the VB.NET, the suggestion is somewhat strange, if you can accept it
I think we just write the whole class library in C#.

If you really, really wants to do this from vb and have the interfaces in
the correct order you can manipulate the MSIL code for the compiled
assembly that contains the interface and have the MSIL be in the order they
want, and then recompile with ilasm.exe and the use tlbexp.exe to create
the TLB.

Here are two links about modify the msil language.
Editing An Interop Assembly
http://msdn.microsoft.com/library/de...us/cpguide/htm
l/cpconeditinginteropassembly.asp

FIX: Tlbimp.exe Generates Interface Wrappers that Cannot Be Used
http://support.microsoft.com/?id=318608


Best regards,

Peter Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: svilen | last post by:
hello again. i'm now into using python instead of another language(s) for describing structures of data, including names, structure, type-checks, conversions, value-validations, metadata etc....
5
by: Secret Guy | last post by:
Because of my experience posting various places over the last couple of weeks: I'm expecting to be greated with hostility for asking about concepts instead of "practical" things, since that has...
27
by: Abdullah Kauchali | last post by:
Hi folks, Can one rely on the order of keys inserted into an associative Javascript array? For example: var o = new Object(); o = "Adam"; o = "Eve";
2
by: Al Reid | last post by:
I'm using VB 2005. I have a production application where I load a ListView with information from several sources based on user interaction. At some point I need to iterate through the Items...
7
by: CDMAPoster | last post by:
I have a form in A97 that requires many textboxes and comboboxes (about 300). The customer insists on seeing all the information on one form so I can't break it up into several forms. Neither...
19
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I access a property of an object using a string?...
54
by: Rasjid | last post by:
Hello, I have just joined and this is my first post. I have never been able to resolve the issue of order of evaluation in C/C++ and the related issue of precedence of operators, use of...
1
by: Jeffrey Christiansen | last post by:
I wanted to add a toggle button to a VB2005 form to be used for a simple Windows Application (i.e. compiled to a "*.exe"), so I added the ActiveX Microsoft Forms Object toggle button, however I...
5
by: akonsu | last post by:
hello, i need to add properties to instances dynamically during run time. this is because their names are determined by the database contents. so far i found a way to add methods on demand: ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.