如何通过单击按钮刷新Windows窗体 [英] How to Refresh the Windows Form By Clicking the Button

查看:125
本文介绍了如何通过单击按钮刷新Windows窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想通过单击Button来刷新Windows窗体。 Windows窗体中的所有工具都会刷新并从数据库中获取值。

I want to refresh the Windows Form by clicking the Button. All that tools in the Windows form get Refreshed and get the Values from Database.

推荐答案

创建一个函数,类似于 RefreshDataViewers(),包含更新控件显示内容所需的代码。然后你只需要在表单中放一个按钮并调用该函数(名为 RefreshDataViewers()的那个)作为其点击事件处理程序。
Create one function, something like RefreshDataViewers(), with the code you need for updating what the controls show. Then you just have to put one button in your form and call that function (the one named RefreshDataViewers()) as part of its Click event handler.


调用 Invalidate()方法 [ ^ ]。


this.Refresh();



在按钮内添加上面的行点击事件。点击此链接

http://stackoverflow.com/问题/ 4685580 / form-reloading-in-c-net [ ^ ]

希望这个帮助。
this.Refresh();

Add above line inside button click event.Refer this link
http://stackoverflow.com/questions/4685580/form-reloading-in-c-net[^]
Hope this help.


这篇关于如何通过单击按钮刷新Windows窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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