Skip to main content

Command Palette

Search for a command to run...

Windows Forms Application – Control Structures Practice II

Published
•2 min read•View as Markdown
Windows Forms Application – Control Structures Practice II
A
I co-founded🫆digizen (fighting internet chaos 🧠), building an AI app to tackle misinformation, and running ideaGeek to turn “I have an idea” into real startups. I also share tech + travel on YouTube (TechNomad & Rz Omar). I touch grass too 🌱… but mostly to debug life 💻

Lab Scenario

Design ONE Windows Form Application with three separate buttons, each button performing a different logical task related to:

  1. Conditions

  2. Switch statement

  3. Loop structures


Form Design Instructions

Create a Windows Form with the following controls:

Form Name: FrmControlPracticeB

Controls to Add

Control TypeNamePurpose
LabellblTitleDisplay application title
TextBoxtxtInputUser input
ButtonbtnConditionCondition-based task
ButtonbtnSwitchSwitch-based task
ButtonbtnLoopLoop-based task
LabellblOutputDisplay output

Task 1: Condition (If / Else)

Button: btnCondition

Task Description

  • Enter a student's marks (0–100)

  • Display the result status based on marks:

    • 75 and above → Distinction

    • 50 – 74 → Pass

    • Below 50 → Fail

Expected Output

Example:
Input: 68
Output: Result: Pass


Task 2: Switch Statement

Button: btnSwitch

Task Description

  • Enter a number from 1 to 4

  • Display the corresponding menu option

Menu Mapping

InputOutput
1Add New Record
2Update Record
3Delete Record
4View Records

Task 3: Loop Structure

Button: btnLoop

Task Description

  • Enter a number N

  • Display all even numbers from 1 to N

Expected Output

Input: 10
Output: 2 4 6 8 10


More from this blog

T

TechNomad

46 posts

TechNomad is mostly coding exercises, not long boring explanations 😌. I share what I teach and learn through hands-on problems—mainly for my students, but anyone can jump in. If you learn by doing (and breaking things), you’ll fit right in. Less theory, more “try this and see what happens.”