我的代码正确,但是不起作用! [英] My code is right, but it's not working!

查看:52
本文介绍了我的代码正确,但是不起作用!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好.

我的代码在我的程序中正确,没有错误,但现在不再起作用.
例如:
退出按钮代码:

hi all.

My code is right in my program ، No error but it does not work anymore.
for example :
exit button code:

application.Exit();


此代码,有时有效,有时无效!

或:
我无法在datagridview中删除一行!
我无法在数据库上搜索!
我无法移动表格!!

请帮我解决这个问题.


this code , sometimes work and sometimes not work!

or :
i can`t delete a row in my datagridview!!
i can`t search on database!!
and i can`t move the forms!!

please help me about this.

推荐答案

C#是区分大小写的编程语言.您应该写:
C# is a case sensitive programing language. you should write:
Application.Exit();


代替


instead of

application.Exit();



如果您编辑代码后仍然出现错误,则可能您有一个名为"Application"的命名空间.在这种情况下,您应该编写完整的名称空间:



If you edit your code and still it was an error, probably you have a namespace named "Application". In this case you should write the complete namespace:

System.Windows.Forms.Application.Exit();


我猜你是Windows应用程序.
在调用Application.Exit()之前尝试调用DoEvents()
I guess yours is a windows application.
Try calling DoEvents() before you call Application.Exit()
System.Windows.Forms.Application.DoEvents();
        System.Windows.Forms.Application.Exit();


这篇关于我的代码正确,但是不起作用!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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