InvaildOperationException“由于对象的当前状态,操作无效". [英] InvaildOperationException "Operation is not valid due to the current state of the object"

查看:199
本文介绍了InvaildOperationException“由于对象的当前状态,操作无效".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个屏幕MaintenanceProgParameter,它是程序参数的主菜单.对于每个参数,我在屏幕上都有一张图像和简短说明.我想通过单击图像显示相应的参数维护屏幕.
我已使用以下代码将处理程序添加到鼠标左键按下事件.
事件如预期的那样引发,但是行"Application.ShowMaintainProductGroup"抛出标题中提到的InvalidOperationException.

I have a screen MaintainProgParameter which is the master for the program parameters. For each parameter I've an image and a short description on the screen. I want to show the according parameter maintenance screen by clicking the image.
I've used the following code to add a handler to the left mouse button down event.
The event is raised like expected but the line "Application.ShowMaintainProductGroup" throws the InvalidOperationException mentioned in the title.

Private Sub MaintenanceProgParameter_Activated()
       AddHandler Me.FindControl("Image_ProductGroup").ControlAvailable,_
           (订阅人(发送者,e)
                                   昏暗img = CType(e.Control,Image)
                                    AddHandler img.MouseLeftButtonDown,AddressOf ProductGroupImageOnClick
                                      结束Sub)

Private Sub MaintainProgParameter_Activated()
        AddHandler Me.FindControl("Image_ProductGroup").ControlAvailable, _
            (Sub(sender, e)
                 Dim img = CType(e.Control, Image)
                 AddHandler img.MouseLeftButtonDown, AddressOf ProductGroupImageOnClick
             End Sub)

结束子

私有子ProductGroupImageOnClick()
      Application.ShowMaintainProductGroup()
结束

Private Sub ProductGroupImageOnClick()
       Application.ShowMaintainProductGroup()
End Sub

希望有人可以帮助我,并向我解释我的代码有什么问题.

Hopefully someone can give me a helping hand and explain me, what's wrong with my code.

欢呼

Uwe

推荐答案

Uwe,

您在Lightswitch中解决了此问题吗?

Did you resolve this issue in Lightswitch?

看来我也有类似的问题.我遇到了相同的错误,但是出现了文本框的LotFocus事件.您的代码看起来与我的代码相似.

It looks like I have a similar problem. I get the same error but with the LotFocus event of a textbox. You code looks similar to what I have.

谢谢!


这篇关于InvaildOperationException“由于对象的当前状态,操作无效".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆