Interop UserControl acts different in .NET and COM

怎甘沉沦 提交于 2019-12-11 17:26:35

问题


I've got an UserControl that works in a quite strange way. By calling a method, the control opens an application in background, take the handle of a form and adds the main control of that last to its own controls. This is the last piece of the code i used:

Dim controlHandle As IntPtr = New IntPtr(WinHandle)
Dim controlWin As Control = Control.FromHandle(controlHandle)
Dim controlView As Control = controlWin.Controls("viewSitePanel")
controlView.Dock = DockStyle.Fill
Controls.Add(controlView)

The controlView contains another UserControl with a grid dinamically populated. In a .NET application I can see the rows of the grid, but when I use the control in a COM application I can't see any row! I used the VB6 Interop UserControl element from the Microsoft InteropForms Toolkit 2.1 to create my control... Somehow it seems like a refresh or similar is not happening... The controlView also contains a detail view with fields dinamically populated and also them don't work... I've got other grids and fields that work inside that control...

I don't know where to start to debug!

Thank you.

来源:https://stackoverflow.com/questions/22509843/interop-usercontrol-acts-different-in-net-and-com

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!