设计一个应用程序,以在C#中的按钮单击事件上在MessageBox中显示TextBox中的文本...

Here, we took two controls on windows form that are TextBox and Button, named txtInput and btnShow respectively. We have to write C# code to display TextBox’s text in the MessageBox on Button Click.

在这里,我们在Windows窗体上使用了两个控件,分别是TextBox和Button,分别命名为txtInput和btnShow 。 我们必须编写C#代码以在Button Click上的MessageBox中显示TextBox的文本

Example:

例:

C# | Display TextBox text in the MessageBox

In the above application, we wrote code on button click event to show text in MessageBox entered in TextBox.

在上面的应用程序中,我们在按钮单击事件上编写了代码,以显示在TextBox中输入的MessageBox中的文本。

private void btnShow_Click(object sender, EventArgs e)
{
	MessageBox.Show(textInput.Text);
}


翻译自: https://www.includehelp.com/dot-net/design-an-application-to-display-text-of-textbox-in-messagebox-on-button-click-event.aspx

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值