473,668 Members | 2,386 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

c# property exposed as COM bindable property

I like to create an assembly with a property exposed in COM as
bindable. I have tried to use [Bindable(true)] attribute but when I
check the typelib produced by regasm for my assembly the property does
not have bindable on it.

Here is some code of what I mean:

[Bindable(true)]
public bool ActiveXDone
{
get
{
return _activeXDone;
}
set
{
_activeXDone = value;
}
}

when I use regasm to generate a typelib for my assembly I like to get
the following (note the bindable attribute):

[id(0x60020000), propget, bindable]
HRESULT ActiveXDone([out, retval] VARIANT_BOOL* pRetVal);
[id(0x60020000), propput, bindable]
HRESULT ActiveXDone([in] VARIANT_BOOL pRetVal);

but instead I get the following :

[id(0x60020000), propget]
HRESULT ActiveXDone([out, retval] VARIANT_BOOL* pRetVal);
[id(0x60020000), propput]
HRESULT ActiveXDone([in] VARIANT_BOOL pRetVal);
What am I doing wrong ?

Nov 17 '05 #1
3 3567
Hi Miguel!

The [Bindable] attribute is for managed design-time environment, as far as I
know it has no effect on COM-visible type libraries.
I have looked through all System.Runtime. InteropServices attributes and it
seems there is no suitable attribute at all :-(.

Re-posting your question in microsoft.publi c.dotnet.framew ork.interop might
give better results.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
<Mi************ @visy.com.au> wrote in message
news:11******** *************@g 49g2000cwa.goog legroups.com...
I like to create an assembly with a property exposed in COM as
bindable. I have tried to use [Bindable(true)] attribute but when I
check the typelib produced by regasm for my assembly the property does
not have bindable on it.

Here is some code of what I mean:

[Bindable(true)]
public bool ActiveXDone
{
get
{
return _activeXDone;
}
set
{
_activeXDone = value;
}
}

when I use regasm to generate a typelib for my assembly I like to get
the following (note the bindable attribute):

[id(0x60020000), propget, bindable]
HRESULT ActiveXDone([out, retval] VARIANT_BOOL* pRetVal);
[id(0x60020000), propput, bindable]
HRESULT ActiveXDone([in] VARIANT_BOOL pRetVal);

but instead I get the following :

[id(0x60020000), propget]
HRESULT ActiveXDone([out, retval] VARIANT_BOOL* pRetVal);
[id(0x60020000), propput]
HRESULT ActiveXDone([in] VARIANT_BOOL pRetVal);
What am I doing wrong ?


Nov 17 '05 #2
Miguel,

You might have to reverse engineer some of the generated code to do
this. Offhand, I would create the TLB file, and then use OLEVIEW to view
the IDL.

Then, I would copy and paste the IDL into a new file, and add the
bindable attribute to the idl in the appropriate places. Once that is done,
I would run that IDL file through MIDL, and create a type library. Once you
do that, you should be able to register that type library to create your
CCW's.

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

<Mi************ @visy.com.au> wrote in message
news:11******** *************@g 49g2000cwa.goog legroups.com...
I like to create an assembly with a property exposed in COM as
bindable. I have tried to use [Bindable(true)] attribute but when I
check the typelib produced by regasm for my assembly the property does
not have bindable on it.

Here is some code of what I mean:

[Bindable(true)]
public bool ActiveXDone
{
get
{
return _activeXDone;
}
set
{
_activeXDone = value;
}
}

when I use regasm to generate a typelib for my assembly I like to get
the following (note the bindable attribute):

[id(0x60020000), propget, bindable]
HRESULT ActiveXDone([out, retval] VARIANT_BOOL* pRetVal);
[id(0x60020000), propput, bindable]
HRESULT ActiveXDone([in] VARIANT_BOOL pRetVal);

but instead I get the following :

[id(0x60020000), propget]
HRESULT ActiveXDone([out, retval] VARIANT_BOOL* pRetVal);
[id(0x60020000), propput]
HRESULT ActiveXDone([in] VARIANT_BOOL pRetVal);
What am I doing wrong ?

Nov 17 '05 #3
Nicholas,

I must say "live and learn" - I did not know before that one could create a
CCW from an already existing type library. Is there an example? What I
personally would try is creating a type library containing interfaces only,
then I'd run tlbimp.exe on it and create my [ComVisible] classes that
implement interfaces imported from the type library.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c om> wrote in
message news:eJ******** ******@TK2MSFTN GP12.phx.gbl...
Miguel,

You might have to reverse engineer some of the generated code to do
this. Offhand, I would create the TLB file, and then use OLEVIEW to view
the IDL.

Then, I would copy and paste the IDL into a new file, and add the
bindable attribute to the idl in the appropriate places. Once that is
done, I would run that IDL file through MIDL, and create a type library.
Once you do that, you should be able to register that type library to
create your CCW's.

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

<Mi************ @visy.com.au> wrote in message
news:11******** *************@g 49g2000cwa.goog legroups.com...
I like to create an assembly with a property exposed in COM as
bindable. I have tried to use [Bindable(true)] attribute but when I
check the typelib produced by regasm for my assembly the property does
not have bindable on it.

Here is some code of what I mean:

[Bindable(true)]
public bool ActiveXDone
{
get
{
return _activeXDone;
}
set
{
_activeXDone = value;
}
}

when I use regasm to generate a typelib for my assembly I like to get
the following (note the bindable attribute):

[id(0x60020000), propget, bindable]
HRESULT ActiveXDone([out, retval] VARIANT_BOOL* pRetVal);
[id(0x60020000), propput, bindable]
HRESULT ActiveXDone([in] VARIANT_BOOL pRetVal);

but instead I get the following :

[id(0x60020000), propget]
HRESULT ActiveXDone([out, retval] VARIANT_BOOL* pRetVal);
[id(0x60020000), propput]
HRESULT ActiveXDone([in] VARIANT_BOOL pRetVal);
What am I doing wrong ?



Nov 17 '05 #4

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

Similar topics

2
321
by: Tommy | last post by:
I added a property to the asp.net textbox. It is set as bindable and i am able to do so. When i go to read the property the value is not there. Somehow it isn't persisted on the server. I tried using ViewState() to set and read the property and it did nothing. Here is the code I am using. Any help is really appreciated. Thanks.. Tommy
0
1504
by: Emil Georgiev | last post by:
Hell I have a Web Custom Control project in ASP.NET. I'm using a subclassing technique to add functionality in HyperLink web server control. I want to create a property "BrowserWindow" of my class "NewWinHyperLink" which will contain child properties. When I use this custom control in testing web application these child properties don't appear with 'plus sign' in visual studio designer. I want to make my parent property to have plus...
0
1205
by: Tommy | last post by:
I have subclassed the textbox and added a property to it with the following code: '-------------------------------------------------------- Imports System.ComponentModel Public Class clsTextBox Inherits System.Web.UI.WebControls.TextBox Private _iPricePk As Integer <Bindable(BindableSupport.Yes)> Public Property iPricePK() As Integer Get
2
4833
by: Lance | last post by:
I want to be able to reset a complex property in a PropertyGrid. I know that for properties that are ValueTypes you can include System.ComponentModel.DefaultValue in the declaration of the property. But, for complex property types (e.g., instance types) this does not work because System.ComponentModel.DefaultValue requires a constant value In order to indicate if a property should be serialized you can include a boolean function named...
3
4773
by: Barry | last post by:
A beginners question to someone that isn't a beginner ;) I've forgotton a lot. The code below isn't what I want to do but it demonstrates succinctly my problem. I want to drop a "MyTextBox" control on a form at design time, set the "DummyProperty" property to be "test value1", and I want to see it showing at design and runtime "test value1". It shows a blank. If I do this with the "Text" property it works but not with my "DummyProperty"...
2
2399
by: Rolf Welskes | last post by:
Hello, I have writen a simple aspnet control MyCtrl and want to use it as follows: (c01 may be the tag-prefix): <c01:MyCtrl>this is a simple text</c01:MyCtrl>. The control-code:
0
5110
by: Andrew Hayes | last post by:
Hi All, I have a web user control (ASCX) that retrieves a set of records from a SQL Server database. What I'd like to do is choose a property of that control as a ControlParameter for an ObjectDataSource. Unfortunately, the custom control doesn't show up in the list of choosable controls in the designer, and even if I select Show Advanced Properties (so I can select my control as a source), it doesn't show the custom properties that I...
0
1421
by: tombow | last post by:
I created a custom control (call it MyWidget) in a C# web control library. MyWidget has a SqlDataSource property: public abstract class MyWidget : WebControl { // .... snipped private SqlDataSource myds;
1
1335
by: shapper | last post by:
Hello, I have a class where I created various controls. One of the controls have a property which is a generic list of WebControl. Then in web site page I have something like: Dim a As New MyNamespace.ListItem a.WebControls.Add(tbName) a.WebControls.Add(lLabel)
0
8459
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
8378
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
8890
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8577
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8653
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5677
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4202
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...
1
2786
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
1783
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.