VC2008, 一个基于MFC的对话框程序,用CWinFormsControl在这个对话框中使用一些.net的控件。 大部分都没有问题,但用到datagridview的时候, 一切都成功,编译,运行,但就是无法显示出绑定好的数据。 datagridview上一片空白。
解决方案是
This is failing because data-binding requires that the bound control have
a BindingContext. Normally the DataGridView would use the BindingContext
belonging to the Form it is on, but since the test application’s DataGridView
is on an MFC dialog rather than on a Form it cannot use its parent’s context.
To use data-binding with the MFC-hosted DataGridView will require that the
application either create and manage the BindingContext on its own or host
the DataGridView inside a ContainerControl (such as a UserControl) which will
manage a binding context for its children.
能否有人能指导一下,如何create and manage the BindingContext on its own 或者如何 host
the DataGridView inside a ContainerControl (such as a UserControl) which will
manage a binding context for its children.
刚刚开始学习.net,困扰好久了。 拜托各位指点一下。 非常感谢!!