开发者

Adding a DataGridView in IronPython Studio Winforms gets a "'DataGridView' object has no attribute 'BeginInit'"

By just adding a datagridview in IronPython Studio it triggers a "DataGridView' object has no attribute 'BeginIni开发者_JAVA技巧t'". Is there a fix for this?

The errors are gone if the lines self._DataGridView1.BeginInit() and self._DataGridView1.EndInit() are deleted, but that's not what it should be done to fix that


There's no fix for this and there's likely not to be one because IronPython Studio isn't supported anymore. DataGridView.BeginInit is implemented explicitly and IronPython Studio is based upon IronPython 1.1. You might be able to work around with it by changing that to "ISupportInitialize.BeginInit(self._DataGridView1)" after importing ISupportInitialize but I doubt it'll survive round tripping through the designer.

If you wanted to fix this yourself the source for IronPython Studio is available and you could try modifying the winforms designer code to notice the explicit interface implementation call and emit this code instead. That's likely just fixing IronPython's CodeDom generator.

But really I'd advise you to move to IronPython Tools and WPF. Generating code for the WinForms designer doesn't really work that well with IronPython and WPF is much more suitable. An alternate plan would be to generate the WinForm w/ the designer in C# and subclass it from Python.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜