C# GUI Essentials (Windows Forms)1. The Core ComponentsIn a GUI app, everything is a Control. Controls live inside a Form (the window).Form: The main container/window.Label: Displays static text.TextBox: Where the user types text.Button: Triggers an action when clicked.CheckBox / RadioButton: For selecting options.ComboBox: A dropdown list.ListBox: A scrollable list of items.2. Event-Driven ProgrammingUnlike a Console app that runs line-by-line from top to bottom, a GUI app waits. It stays idle until an "Event" happens (like a mouse click).C#// This is an Event Handler
// It runs ONLY when 'button1' is clicked
private void button1_Click(object sender, EventArgs e)
{
    MessageBox.Show("You clicked the button!");
}
3. Basic GUI Operations (Copy-Paste List)Getting and Setting TextThe most common task is grabbing what a user typed and showing a result.C#// Get text from a TextBox
string userName = txtInput.Text;

// Set text on a Label
lblOutput.Text = $"Welcome, {userName}";

// Clear a TextBox
txtInput.Clear();
Working with Message BoxesPop-up alerts for the user.C#// Simple alert
MessageBox.Show("Operation Successful!");

// Alert with a Title and Buttons
DialogResult result = MessageBox.Show("Delete file?", "Confirm", MessageBoxButtons.YesNo);

if (result == DialogResult.Yes) {
    // Code to delete
}
Lists and Dropdowns (ComboBox/ListBox)C#// Adding items via code
myComboBox.Items.Add("Option 1");
myComboBox.Items.Add("Option 2");

// Getting the selected item
string selected = myComboBox.SelectedItem.ToString();
Changing Colors and VisibilityYou can change the UI look dynamically while the app is running.C#btnSubmit.BackColor = Color.Red;   // Change color
lblWarning.Visible = false;        // Hide a label
btnSubmit.Enabled = false;         // Gray out a button (disable it)
4. The "Hidden" Code (Designer vs. Code-Behind)When you create a GUI app, Visual Studio splits your class into two files:Form1.Designer.cs: This is code generated by the computer when you drag-and-drop buttons in the visual editor. Don't touch this manually!Form1.cs: This is where you write your logic (the event handlers).5. Common GUI PropertiesYou usually set these in the Properties Window in Visual Studio, but you can do it in code too:PropertyPurposeNameHow you refer to the control in code (e.g., btnSave)TextWhat the user actually sees written on the controlFontChanges the size and style of textTabIndexDetermines the order of focus when the user hits the "Tab" keyA Simple Workflow ExampleIf you wanted to make a "Counter" app:Drag a Label onto the form (Name it lblCount, set Text to 0).Drag a Button onto the form (Name it btnUp, set Text to +1).Double-click the button to create the click event.Write this code:C#int count = 0;

private void btnUp_Click(object sender, EventArgs e)
{
    count++; // Add to the number
    lblCount.Text = count.ToString(); // Update the UI
}