页面中有一个button       ID为:btnUpdate,

   还有一个输入框textbox   ID为:tbResultShow  点击按钮实用异步线程: begininvoice修改页面中中textbox中的值。

#region  使用BeginInvoke修改text中的值
        // 委托
        private delegate void UpdateUiHandler(string strTestUpdate);
        /// <summary>
        /// 修改text中的值
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btnUpdate_Click(object sender, EventArgs e)
        {
            this.BeginInvoke(new UpdateUiHandler(UpdateText), new object[] { "  改变显示框中的值 " });  
        }
        /// <summary>
        /// 改变显示框中值的具体方法
        /// </summary>
        /// <param name="strTestUpdate"></param>
        private void UpdateText(string strTestUpdate)
        {
            this.tbResultShow.Text = strTestUpdate;
        }
        #endregion

 

     因为感觉前面写的不够明白所以又发了一次。嘻嘻。

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-02-17
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
  • 2021-06-17
  • 2021-09-30
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-17
  • 2021-05-28
  • 2021-08-27
  • 2022-01-20
  • 2022-12-23
相关资源
相似解决方案