开发者

Data Binding a COM Interop .Net Control

Is it possible to wrap a .NET control up as an ActiveX control to be used in a COM application (VB6 or MS Access VBA) and allow the COM application to set the data binding? I'd like the control to be a bound control but I do not want t开发者_StackOverflowo have to write separate data access routines for the control.

For example, I'd like to have AutoSuggest functionality in an MS Access comboxbox and so I'm considering using .NET's combobox control together with COM interop. However, I think my question extends to other .NET controls as well.

Edit1:

Judging by the answers coming in, it appears that many developers are unaware of the fact that you can take .NET controls and turn them into COM Interop ActiveX controls. In order to do this you have to download and install a toolkit from Microsoft called "Interop Forms Toolkit 2.1".

What's baffling me though is how you might pass values to these controls such as DAO fields for binding so that the control itself doesn't have to setup a database connection and operate independently from the DAO Bound MS Access form that the control is located on.


Nope, you can't do that. The .NET Languages allow you to build ActiveX DLLs, but that is not what you want.


No you can't create an ActiveX control in .NET.

You could create a .NET assembly that contained a form with a .NET combobox and expose a COM interop function called SelectValue but you would have to pass all your selection options to the assembly and it return what the user selected, so depending on the cirumstances this may not be feasible, efficient, worth the time, etc.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜