问题
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