Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

write a C# WPF application called HelloYourName that includes a label, textbox,

ID: 3854564 • Letter: W

Question

write a C# WPF application called HelloYourName that includes a label, textbox, and button

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace HelloYourName
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
void MainWindow(object sender, EventArgs e)
{

}

void btn_1_Click(object sender, EventArgs e)
{
string var;
var = textBox1.Text;
MessageBox.Show(var);
}
}
}
}

I can't figure out how to get the system to rationalize when the button has been clicked and then read the user input from the text box, and display it in the message box below with the prefilled message combined with the user input, so it should look like this.

"Hello Jonathan, Welcome to Class!"

Explanation / Answer

Try these codes into your window and check out the results:-

using System.Windows.Forms;

namespace WindowsFormsApp
{
public partial class FormApp1 : Form
{
public FormApp1()
{
InitializeComponent();
}

private void FormApp1_Load(object sender, EventArgs e)
{
textBox1.Width = 250;
textBox1.Height = 50;
textBox1.Multiline = true;
textBox1.BackColor = Color.Black;
textBox1.ForeColor = Color.White;
textBox1.BorderStyle = BorderStyle.Fixed3D;
}

private void button1_Click(object sender, EventArgs e)
{
string var;
var = textBox1.Text;
MessageBox.Show(var);
}
}
}