473,770 Members | 7,287 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to expose properties in COM interop

Hi , I have a COM object implemented in C#
Problem is that my properties ( which defined public in the class ) can not
be seen from the outside ( When I call COM )
I can see only functions I defined in class interface.
If I try to define variables there I get an error : Interfaces can not
contain variables ( which is understandable ).
Question. How to expose variables.

Thanks,
Roman Prigozhin
P.S
If you want to suggest implement set and get functions to do that , please
don't bother, it is an obvious solution.
I want to know the other way of doing it through definitions.
Nov 15 '05 #1
1 2013
Prigozhin,

When declaring your interface, you can just do this:

public interface IMyInterface
{
string MyProperty {get; set;}
}

You can choose to omit either get or set to get write-only or read-only
functionality.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Prigozhin Roman" <pr************ @yahoo.com> wrote in message
news:u3******** *****@TK2MSFTNG P10.phx.gbl...
Hi , I have a COM object implemented in C#
Problem is that my properties ( which defined public in the class ) can not be seen from the outside ( When I call COM )
I can see only functions I defined in class interface.
If I try to define variables there I get an error : Interfaces can not
contain variables ( which is understandable ).
Question. How to expose variables.

Thanks,
Roman Prigozhin
P.S
If you want to suggest implement set and get functions to do that , please
don't bother, it is an obvious solution.
I want to know the other way of doing it through definitions.

Nov 15 '05 #2

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

Similar topics

6
1900
by: rakefet | last post by:
Hi. I'm really new to this world of .Net so your help would be most appreciated... We have API and COM interfaces developed in c. We would also like to supply a .net interface to our clients. Searching - I found many new words :-) like .Net wrapper, Assembly... but I couldn't find a clear cut answer -
3
1813
by: John Baro | last post by:
I have a class as: public class a : { private float m_b; public float b { get {
0
1350
by: John Svazic | last post by:
Hi, I'm trying to create an Add-In for MS Project and I want to be able to read some custom properties out from the Project. I'm using the Office Interop module that came with MS Project, and there is a property in the Microsoft.Office.Interop.MSProject.Project object called CustomDocumentProperties which returns me an object, but this object is a System.__ComObject, which doesn't really help me very much. Can anyone help me out...
2
1074
by: ljh | last post by:
I am using some 3rd party controls to create my own control. I want to "pass up" many (but not all) of the properties of the 3rd party controls that I am using to make my control, so that the end user can customize as much or as little as they wish. But, there are HUNDREDS of properties (of the combined controls). Is there an easy way to expose the properties of the controls that I am using to make my control adn still be able to...
9
1659
by: Dimsion | last post by:
Hi, How do i expose all my forms and it controls to other form in the project? I want to be able to add a form and some control on it, this then be available to all other forms. form1 click event: 'this allow me to change the textbox on form2 from form1 Form2.text="" 'this allow me to add item to form2 from form1
1
3356
by: erik | last post by:
Hi! Is it possible to expose customer properties used in a class in a web servies. Can I use on a property or how do I do? The thing is that I do not want to use parameters for the method I have developed but instead use properties. /erik
19
1458
by: pinkfloydhomer | last post by:
I can understand why properties are neat if you want to limit access (only get, no set), or you want to do some bookkeeping or sanity checking on values (in set) or if you want to change the underlying type without changing the property type etc. But what is the use for properties like: private int data; public int Data
0
1157
by: Probi | last post by:
Hi, I´m trying to make word automation on document custom properties(for a given property name change the value) I put this code together: Type Prop = Type.GetTypeFromProgID("Word.CustopParoperties"); System.Object obj = Activator.CreateInstance(Prop); Microsoft.Office.Interop.Word.CustomProperties CustomProp = obj as Microsoft.Office.Interop.Word.CustomProperties;
0
953
by: =?Utf-8?B?UHJvYmk=?= | last post by:
I´m trying to do some Word Automation in C# in the Custom Properties so far found very few ways to do that I made the following : Type Prop = Type.GetTypeFromProgID("Word.CustopParoperties"); System.Object obj = Activator.CreateInstance(Prop); Microsoft.Office.Interop.Word.CustomProperties CustomProp = obj as Microsoft.Office.Interop.Word.CustomProperties;
0
9592
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9425
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10058
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7416
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5313
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5450
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3972
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2817
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.