设计一个应用程序,以在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:
例:
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
總結
以上是生活随笔為你收集整理的设计一个应用程序,以在C#中的按钮单击事件上在MessageBox中显示TextBox中的文本...的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: express rest_Express
- 下一篇: Python | 如何使用pip升级所有