在windows窗体应用程序C#.net上刷新button_Click上的表单内容 [英] refreshing the content of form on button_Click in windows form application C#.net

查看:113
本文介绍了在windows窗体应用程序C#.net上刷新button_Click上的表单内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请帮助解决这个问题,我正在尝试刷新点击按钮上的所有内容,我该怎么办,请帮助。

please help on this matter, i am trying to refresh all the content on the click of button, how can i do it, Please help.

推荐答案

来自我的知识,我们可以关闭当前的表格并通过单击按钮再次打开它或我们可以通过单击按钮更改特殊部分..差异。是我们想的方式...

参考下面的代码...



From my Knowledge, we can close the current Form and open it again by single button click or we can change the Particular part with the single button click.. the diff. is the way what we think...
refer the code below...

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            GetCurrentTime();
        }

        void GetCurrentTime()
        {
            // Type your Form_Load Code Here... 
            label1.Text = System.DateTime.Now.ToString();

        }

        private void button1_Click(object sender, EventArgs e)
        {
            GetCurrentTime();

            // Or u can done by this way...

            //this.Hide();
            //Form1 cf = new Form1();            
            //cf.Show();
        }
    }


这篇关于在windows窗体应用程序C#.net上刷新button_Click上的表单内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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