Practical 1: Your first Windows Forms program
- Install or open Visual Studio Community. Create a new project: Windows Forms App (.NET Framework), language Visual Basic, name
HelloApp. - From the Toolbox add a TextBox (
txtName), a Button (btnHello, Text “Say hello”) and a Label (lblMessage). - Double-click the button and type:
lblMessage.Text = "Hello, " & txtName.Text - Press F5 to run. Type a name and click the button.
- Change at least three properties (form BackColor, label Font and ForeColor, button Text) and run again.
Check it works: The label greets the name you type.
Keep: A screenshot of your form running, and of the Properties you changed.
Practical 2: Two-number calculator
- Make a form with two text boxes, four buttons (+, −, ×, ÷) and a result label.
- Declare variables with suitable data types and write code for each button.
- Move the calculation into a function so each button calls it.
- Add an extra button that shows the remainder using
Mod. - What happens if you divide by zero, or type a letter? Note it down: you will fix it in Practical 8.
Check it works: All four operations give correct answers.
Keep: Annotated code (comments on every part) and screenshots.
Practical 3: Temperature converter (from design to code)
- Write pseudocode for a program that reads °C, converts it to °F with F = C × 9 / 5 + 32, and displays the result.
- Draw the flowchart and dry-run it with a trace table for 0, 37 and 100.
- Build it in Visual Basic, using a constant where sensible.
- Compare your program with your design. Did you need to change anything?
Check it works: 0 → 32, 37 → 98.6, 100 → 212.
Keep: Pseudocode, flowchart, trace table and the program.
Practical 4: Selection: login and grade calculator
- Make a login form: a password box (set
PasswordChar to *) and a button. Show “Access granted” or “Access denied”. - Make a grade calculator for a mark out of 100 using If … ElseIf … Else.
- Make a Select Case program that turns a day number 1–7 into the day name, with Case Else for anything else.
- Write a test table for the grade calculator with normal, boundary and erroneous data.
Check it works: Every boundary mark gives the correct grade.
Keep: Code and your test table.
Practical 5: Loops: tables, totals and guessing game
- Use a For loop to show any times table (chosen by the user) in a ListBox.
- Show the running total of 1 to N in a multiline text box.
- Build a guessing game: the computer picks a number 1–50 (
Dim r As New Random : secret = r.Next(1, 51)); use a loop to give “higher/lower” hints until the user guesses it, then show the number of guesses. - Explain which loop you used for each part and why.
Check it works: The game always ends when the right number is guessed.
Keep: Code and screenshots.
Practical 6: Arrays and strings: team list
- Use
InputBox in a loop to store six player names in an array, then display them in a ListBox. - Add a Search button that finds a name and shows its position, or “not found”.
- Show each player’s initials in capitals using
Substring and ToUpper. - Sort the names alphabetically with
Array.Sort and show them again.
Check it works: Searching for a name that is not in the list shows “not found”.
Keep: Code and screenshots.
Practical 7: File handling: save and load a list
- Add a Save button to Practical 6 that writes every name to
team.txt (one per line) using StreamWriter. - Add a Load button that reads the file back into the ListBox using
StreamReader. - Close the program, open it again and load the names. They should still be there.
- Make it robust: if the file does not exist, show a friendly message instead of crashing.
Check it works: Names survive closing and reopening the program.
Keep: Code, the text file contents and screenshots.
Practical 8: Make it robust: validation and error handling
- Go back to your calculator (Practical 2).
- Add a presence check and a type check (
Integer.TryParse or Decimal.TryParse) to every input. - Stop division by zero with a helpful message.
- Wrap risky code in
Try … Catch and show a friendly error. - Re-run your tests from Practical 2. What changed?
Check it works: No input you can type will crash the program.
Keep: Before-and-after test results.
Practical 9: Debugging challenge
- Your teacher gives you a program with three faults (one syntax, one runtime, one logic).
- Use the Error List to find the syntax error.
- Use test data to make the runtime error happen, then fix it with validation.
- Set a breakpoint (F9), step through (F10) and watch the variables to find the logic error.
- Record each fault in a table: type, symptom, cause, fix, re-test result.
Check it works: All three faults are fixed and re-tested.
Keep: Your fault table.
Practical 10: Mini project: quiz program
- Design a quiz program: a question, four answers labelled A–D, a Submit button, a Quit button and an area that shows whether the answer was right (as in your scheme of work).
- Produce two alternative screen layouts and a navigation diagram, and choose one with a reason.
- Store at least five questions in arrays (or an array of records), with the correct answers.
- Develop it with selection, a loop or counter for the score, and comments throughout.
- Test it, get feedback from two classmates, improve it, and write a short review. This is practice for your assignments; do not reuse it as assignment evidence.
Check it works: The final score is correct for any set of answers.
Keep: Design, code, tests, feedback and review: your practice portfolio.