By the end of this chapter, you will be able to:
These skills will help you create reliable, user-friendly desktop applications while keeping yourself and the environment safe in the workplace.
Compiled by: Stephen Mbugua
Writing desktop application source code is a foundational skill for software developers in Kenya’s growing ICT sector. This chapter provides a detailed exploration of the tools and environments used in desktop application development, including how to select appropriate tools based on system requirements. Mastery of these tools is critical for producing efficient, maintainable, and robust software solutions that serve diverse sectors such as banking, education, healthcare, and government services.
Professional desktop application development uses a set of tools that speed up writing, debugging and delivering code. The most important of them is the Integrated Development Environment (IDE), which gathers an editor, a compiler, a debugger and a form designer in one window and so raises both productivity and code quality. Knowing the features and parts of these tools, and the criteria for choosing between them, lets a developer match the environment to the project and to the client's expectations. The code examples in this topic use C# and Windows Forms in Visual Studio, in line with the unit's practical work.
Desktop application development tools support every stage of the software development life cycle. They combine code editors, compilers, debuggers and graphical user interface (GUI) designers so that applications can be built for Windows, macOS or Linux. Software often has to work with the client's existing programs, such as an accounting package or a shared database, and good tools help the developer manage that complexity and keep the new program compatible.
Example: a software firm building a booking program for small lodges relies on the form designer to draw the booking screens, on the debugger to trace wrong totals, and on Git integration to share the code between two developers.
javac or Maven that turn source code into executable files, which an IDE normally runs for the developer.Visual Studio, NetBeans and the JetBrains IDEs are three widely used families of environments for desktop application development. Each offers advantages for particular programming languages and project types, and the developer compares them against the needs of the project.
Visual Studio from Microsoft is an IDE for building applications with languages such as C#, VB.NET and C++. It runs on Windows and is the main environment for .NET desktop applications built with Windows Forms or Windows Presentation Foundation (WPF).
Apache NetBeans is an open-source IDE used mainly for Java desktop applications. It runs wherever Java runs, including Windows, macOS and Linux.
JetBrains makes a family of IDEs that share one style of working: IntelliJ IDEA for Java and Kotlin, PyCharm for Python, Rider for .NET and CLion for C and C++. They stress productivity and intelligent help while the developer types.
Licensing differs between JetBrains products, so the licence of the chosen IDE is checked before it is adopted for a client project.
Choosing a development tool depends on the technical and business needs of the project. Matching a tool's strengths to the system requirements gives efficient development now and easier maintenance later.
The choice of IDE strongly affects the productivity of the developer and the quality of the finished application. The environments below are widely used, and each fits a typical kind of project.
Visual Studio is the main environment for .NET desktop applications, because its designers, debugger and project templates for Windows Forms and WPF come with it. Example: a firm writing a payroll program for a chain of salons, all running Windows, uses Visual Studio and C#.
NetBeans suits Java developers who build desktop software that must run on different operating systems from one code base. Example: a point-of-sale program for small shops, some on Windows and some on Linux, is built once in Java Swing with NetBeans.
IntelliJ IDEA from JetBrains is chosen for Java and Kotlin projects where strong code analysis and refactoring matter. It also supports other languages that run on the Java Virtual Machine.
Eclipse is an open-source IDE that supports many languages through plugins and is used for teaching and prototyping as well as for production work. A developer who wants a free Java environment with a large plugin library often starts here.
Lazarus is a free IDE for the Pascal language, with a form designer in the style of older Delphi programs. It is used to maintain existing Pascal applications and to build small cross-platform tools.
An IDE brings the essential development tools together in one application window. Knowing its parts lets the developer use the whole environment and not just the editor.
In Visual Studio these parts appear as windows that can be docked around the editor:
| Name | Specification | Use |
|---|---|---|
| Solution Explorer | Tree of the solution, its projects and their files | Open, add, rename and delete project files |
| Toolbox | Palette of controls grouped by type | Drag controls onto a form in the designer |
| Properties window | List of the properties and events of the selected item | Set Text, Name and Enabled, and create event handlers |
| Error List | Table of errors and warnings found by the compiler | Jump to the line that needs fixing |
| Output window | Text output of builds and of the running program | Read build results and debug messages |
Controls and objects are the building blocks of every desktop interface. A control is an object that the user can see and use, such as a button or a list, while an object may also be an invisible part of the program, such as a timer or a data connection. Choosing the right control for each task decides how easy the application is to use and how little data the user types wrongly. The seven controls named below are widely used in everyday Windows Forms screens.
Several other controls often appear alongside the seven that follow:
Objects stand for both controls and non-visual components such as timers, data connections and file handlers. Object-oriented programming lets developers write reusable, modular code that is easier to maintain. Example: a program for an electronics repair shop uses a Timer object to refresh the list of open repair jobs every minute, a connection object to reach the file that stores the jobs and a RepairJob object to hold the details of one job. The form uses all three, but only the controls have a visible part.
A button is a control that starts an action when the user clicks it, such as saving a record, opening a file or printing a receipt. Buttons are the main way a user gives a command, so their text must say plainly what will happen, such as Save booking and not just OK. In Windows Forms the class is Button.
Key properties and members of a button:
&Save, makes Alt+S press it from the keyboard.false the button is greyed out and cannot be clicked, which prevents actions that are not allowed yet.DialogResult.OK.The form can name a default button with AcceptButton, pressed by the Enter key, and a cancel button with CancelButton, pressed by the Escape key. Example: a photo studio booking form disables the Save button while a booking is being saved, so that a second click cannot save the same booking twice.
private async void btnSaveBooking_Click(object sender, EventArgs e)
{
btnSaveBooking.Enabled = false; // blocks a second click while the save runs
try
{
await SaveBookingAsync(); // a method written elsewhere in the form, returning Task
lblStatus.Text = "Booking saved.";
}
finally
{
btnSaveBooking.Enabled = true;
}
}
The handler is marked async and awaits the save, so the form keeps responding and the disabled button really does refuse a second click. A save that blocked the form's own thread would not work this way: the second click would wait in the queue and be handled as soon as the button is enabled again.
A text box lets the user type or edit text, so it is the main control for data entry. Every value typed arrives as text, even a quantity or a date, so the program must check and convert it before using it. In Windows Forms the class is TextBox.
Key properties and members of a text box:
The events used most are TextChanged, KeyPress and Validating. Example: a garage job card form checks the customer name and the mileage before saving.
private void btnSaveJob_Click(object sender, EventArgs e)
{
if (string.IsNullOrWhiteSpace(txtCustomerName.Text))
{
MessageBox.Show("Enter the customer name.");
txtCustomerName.Focus();
return;
}
if (!int.TryParse(txtMileage.Text, out int mileage) || mileage < 0)
{
MessageBox.Show("Enter the mileage as a whole number, zero or more.");
txtMileage.Focus();
return;
}
// the name and mileage are valid: save the job card here
}
A label shows text that the user reads but does not edit, such as a caption beside a text box, an instruction or a result. A label can also be changed by code while the program runs, which makes it the usual place to show totals and status messages. In Windows Forms the class is Label.
Key properties of a label:
true the label grows to fit its text.&Phone:, give keyboard access to the control that follows it in the tab order.Example: a car wash billing screen shows the total in a label and changes the text, not only the colour, so the message is clear to every user.
private void ShowTotal(decimal total, bool paid)
{
lblTotal.Text = $"Total: Ksh {total:N2}";
lblPayment.Text = paid ? "Paid" : "Payment pending";
lblPayment.ForeColor = paid ? Color.DarkGreen : Color.Firebrick;
}
With a total of 1250 the label shows Total: Ksh 1,250.00. Colour is used as an extra signal only, because some users cannot tell colours apart.
A combo box combines a text box with a drop-down list. It lets the user pick from a fixed set of choices, which prevents spelling mistakes and keeps the data consistent. In Windows Forms the class is ComboBox.
Key properties and members of a combo box:
DropDown lets the user type or pick, DropDownList allows picking only, and Simple shows the list open under the text box.Example: a hotel reservation form fills the room type list when the form loads and allows picking only, so a type that does not exist can never be entered.
private void ReservationForm_Load(object sender, EventArgs e)
{
cmbRoomType.Items.AddRange(new object[] { "Single", "Double", "Twin", "Family" });
cmbRoomType.DropDownStyle = ComboBoxStyle.DropDownList;
cmbRoomType.SelectedIndex = 0;
}
private void cmbRoomType_SelectedIndexChanged(object sender, EventArgs e)
{
lblChosen.Text = "Chosen: " + cmbRoomType.SelectedItem;
}
A data grid shows many records in rows and columns, like a spreadsheet, and can let the user sort, select and edit them. In Windows Forms the control is DataGridView, which replaced the older DataGrid control from .NET Framework 2.0 onwards. It is the usual control for stock lists, order lists and report previews.
Key properties and members of a data grid:
HeaderText and DefaultCellStyle.Format control titles and number formats.FullRowSelect selects a whole record when any cell is clicked.CellClick, CellValueChanged and SelectionChanged report what the user did.Example: a farm produce store lists its stock in a grid and shows the value of the chosen row.
public class ProduceItem
{
public string Name { get; set; } = string.Empty;
public decimal Kilograms { get; set; }
public decimal PricePerKg { get; set; }
public decimal Value() => Kilograms * PricePerKg;
}
private readonly BindingList<ProduceItem> produce = new BindingList<ProduceItem>();
private void StoreForm_Load(object sender, EventArgs e)
{
produce.Add(new ProduceItem { Name = "Tomatoes", Kilograms = 120m, PricePerKg = 90m });
produce.Add(new ProduceItem { Name = "Onions", Kilograms = 80m, PricePerKg = 110m });
dgvProduce.DataSource = produce;
dgvProduce.ReadOnly = true;
dgvProduce.AllowUserToAddRows = false;
dgvProduce.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
dgvProduce.Columns["PricePerKg"].HeaderText = "Price per kg (Ksh)";
}
private void dgvProduce_SelectionChanged(object sender, EventArgs e)
{
if (dgvProduce.CurrentRow?.DataBoundItem is ProduceItem item)
{
lblValue.Text = $"Stock value: Ksh {item.Value():N2}";
}
}
The two rows are sample data. When the tomatoes row is selected the label shows 120 × 90 = 10,800, written as Stock value: Ksh 10,800.00. The code needs using System.ComponentModel; for BindingList.
A list view shows a list of items that can be displayed as a detailed table with columns, or as icons or tiles, much as a file explorer shows files. It suits shorter lists that the user browses and selects from. In Windows Forms the class is ListView, and each row is a ListViewItem whose extra columns are held in SubItems.
Key properties and members of a list view:
Details, List, SmallIcon, LargeIcon or Tile, which sets how the items are drawn.Details view.Example: a salon booking screen lists the day's appointments and shows the client chosen in the list.
private void BookingsForm_Load(object sender, EventArgs e)
{
lvwBookings.View = View.Details;
lvwBookings.FullRowSelect = true;
lvwBookings.GridLines = true;
lvwBookings.Columns.Add("Client", 140);
lvwBookings.Columns.Add("Time", 70);
lvwBookings.Columns.Add("Service", 120);
var row = new ListViewItem("Amina");
row.SubItems.Add("09:30");
row.SubItems.Add("Braiding");
lvwBookings.Items.Add(row);
}
private void lvwBookings_SelectedIndexChanged(object sender, EventArgs e)
{
if (lvwBookings.SelectedItems.Count > 0)
{
lblClient.Text = lvwBookings.SelectedItems[0].Text;
}
}
The data grid and the list view both show rows, but they suit different jobs:
| Feature | ListView | DataGridView |
|---|---|---|
| Filling | Rows are added by code, one ListViewItem at a time |
Can be bound to a list or table through DataSource |
| Editing | Only the item label can be edited | Individual cells can be edited |
| Display styles | Details, list, small icon, large icon and tile views | A table of rows and columns only |
| Best for | Short lists to browse and pick from | Larger tables of records to view or edit |
A form is a window of the application. It is a container control that holds all the other controls, and it is also an object, so it has properties, methods and events of its own. Every desktop application has at least one form, and larger ones have many, such as a main window, a dialog for adding a record and a report preview. In Windows Forms the class is Form, and the program starts when Application.Run is given the first form.
Key properties, methods and events of a form:
Show opens a modeless form that lets the user switch back to the previous window, while ShowDialog opens a modal form that must be closed first.Example: a courier counter program opens a dialog to add a parcel and reads the tracking number from it when the user confirms.
// in the main form
private void btnNewParcel_Click(object sender, EventArgs e)
{
using (var dialog = new ParcelForm())
{
if (dialog.ShowDialog(this) == DialogResult.OK)
{
lblStatus.Text = "Parcel " + dialog.TrackingNumber + " added.";
}
}
}
// in ParcelForm
public string TrackingNumber => txtTracking.Text.Trim();
The OK button of ParcelForm has its DialogResult property set to OK, which closes the dialog and makes ShowDialog return DialogResult.OK.
The FormClosing event gives the program a chance to stop the form from closing, for example when work has not been saved:
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
var answer = MessageBox.Show("Close the application?", "Confirm", MessageBoxButtons.YesNo);
if (answer == DialogResult.No)
{
e.Cancel = true;
}
}
Setting e.Cancel to true keeps the form open. A program with several documents can also use a Multiple Document Interface, in which one parent form holds many child forms.
Create a free account to open more of this chapter.
Free: practical guides, quick cards, workplace scenarios and more.
Create a free accountThis chapter explored the essential tools and environments used in desktop application development, highlighting popular integrated development environments such as Visual Studio, NetBeans, and JetBrains. It emphasized the importance of selecting development tools based on specific system requirements and detailed the various controls and objects commonly used in application interfaces, including buttons, textboxes, labels, and data grids. The process of developing an application interface was discussed with attention to design patterns like MVC and user experience best practices. Database design was covered by focusing on understanding user data needs, choosing appropriate database models, and establishing data relationships. Techniques for database integration were examined, including ensuring data consistency and employing APIs and ORM tools. The chapter also addressed workplace safety and health practices relevant to software development, referencing OSHA regulations and the significance of ergonomics. Finally, it covered e-waste management by outlining proper storage, disposal methods, and the importance of staff training and monitoring in handling electronic waste responsibly.
Type: Individual
| Tools & Equipment | Materials |
|---|---|
| Computer with Windows 10 OS installed | Visual Studio Community Edition installer |
| Internet connection with minimum 5 Mbps speed | NetBeans IDE installer |
| JetBrains IntelliJ IDEA Community Edition installer |
| S/N | Item | Quantity |
|---|---|---|
| 1 | Computer with Windows 10 OS installed | 1 Pc per Candidate |
| 2 | Internet connection with minimum 5 Mbps speed | 1 Connection per Candidate |
| 3 | Visual Studio Community Edition installer | 1 Copy per Candidate |
| 4 | NetBeans IDE installer | 1 Copy per Candidate |
| 5 | JetBrains IntelliJ IDEA Community Edition installer | 1 Copy per Candidate |
| Items to be Evaluated | Marks Available | Marks Obtained | Comments |
|---|---|---|---|
| TASK 1: Identify and select suitable IDE | |||
| Analyzed system requirements to determine IDE suitability (Award 4 marks for correct identification of IDE based on system requirements) | 4 | ||
| Compared features of Visual Studio, NetBeans, and JetBrains IntelliJ IDEA (Award 3 marks for clear comparison of IDE features relevant to desktop app development) | 3 | ||
| Justified selection of IDE based on criteria such as language support, ease of use, and project type (Award 3 marks for valid justification for chosen IDE) | 3 | ||
| Sub-Total | 10 | ||
| TASK 2: Install and configure the selected IDE | |||
| Downloaded or accessed the correct IDE installer (Award 2 marks for accessing correct installer) | 2 | ||
| Successfully installed the IDE with default or customized settings as required (Award 5 marks for correct installation process without errors) | 5 | ||
| Configured IDE settings such as workspace, theme, and language preferences (Award 3 marks for proper configuration of development environment) | 3 | ||
| Sub-Total | 10 | ||
| PRODUCT CHECKLIST | |||
| Installed IDE launches successfully and displays the start screen (Award 5 marks if IDE launches without errors and is ready for desktop application development) | 5 | ||
| IDE correctly configured with user preferences as specified (Award 5 marks for correct configuration of IDE settings) | 5 | ||
| Sub-Total | 10 | ||
| GRAND TOTAL | 30 | ||
Type: Individual
| Tools & Equipment | Materials |
|---|---|
| Computer installed with Visual Studio 2019 | Visual Studio Project with 3 source code files |
| Rewritable Compact Disc (CD-RW) |
| S/N | Item | Quantity |
|---|---|---|
| 1 | Computer installed with Visual Studio 2019 | 1 Pc per Candidate |
| 2 | Rewritable Compact Disc (CD-RW) | 1 Pc per Candidate |
| Items to be Evaluated | Marks Available | Marks Obtained | Comments |
|---|---|---|---|
| TASK 1: Create and Explore IDE Project | |||
| Opened Visual Studio and created a new project (Award 2 marks for correctly creating a new project) | 2 | ||
| Added at least 3 source code files to the project (Award 3 marks for adding 3 or more source files) | 3 | ||
| Opened and demonstrated use of the Code Editor (Award 3 marks for showing code editing features like syntax highlighting, line numbers) | 3 | ||
| Navigated and explained the Project Explorer pane (Award 2 marks for correctly using Project Explorer to view project files) | 2 | ||
| Used the Debugger to set breakpoints and run the application (Award 5 marks for setting breakpoints, starting debug mode, and stepping through code) | 5 | ||
| Saved the project and copied it onto the CD-RW (Award 2 marks for correctly saving and backing up the project to CD-RW) | 2 | ||
| Sub-Total | 17 | ||
| PRODUCT CHECKLIST | |||
| Project contains at least 3 source code files and is correctly saved on CD-RW (Award 8 marks for completeness, correct file count, and successful backup) | 8 | ||
| Sub-Total | 8 | ||
| GRAND TOTAL | 25 | ||
At the start of this chapter we promised you would be able to:
Tick each one you can genuinely do.
So, are you there yet?
You're competent when you can confidently do 50% or more of what this chapter promised.
Sign in to record how you're doing.