FahmidasClassroom

Learn by easy steps

P7

Different types of applications can be developed by using C#.NET. Desktop application is one of them. Various types of desktop applications can be developed by using C#.NET. You have to install the Visual studio with C#.NET that has been shown on another tutorial. The way of creating your first desktop application has been shown in this tutorial.

Click on the Create a new project option to create a project for desktop application.

P1

Now, select the Windows Form App (.NET Framework) option and click on the Next button.

P2

Set the Project name, Location, Solution name, and Framework for the project.

P3

The following window will appear after selecting the project.

P4

Open the Toolbox window to design the form by clicking the View menu.

P5

The following Toolbox will appear. You can change the properties of the form window by clicking the form window. Set the size and position of the form window by setting the Size and StartPosition properties.

P6
1000011155

Design the form like the following image by using label, textbox, and button tools.

P7

The following window will be displayed in the center of the screen after running the project.

P8

Add the following code in the button click() method. Save the file and run the application.

string name = textBox1.Text;
string email = textBox2.Text;
string password = textBox3.Text;
if (name != "" && email != "" && password != "")
{
    MessageBox.Show("Registration Completed.","Form Submitted successfully");
}
else
{
    MessageBox.Show( "Invalid data.", "Invalid Form Data");

}

If the Register button is pressed after adding data on all fields of the form then the following message will appear.

P9

If the Register button is pressed by keeping any field empty of the form then the following message will appear.

P10

The way of creating a simple form by using some basic tools has been shown in this tutorials. Many types of tools are available in the ToolBox to design different types forms for the desktop application.

Exercise:

Design a simple calculator that will be able to do the following operations.

A. Addition
B. Subtraction
C. Multiplication
D. Division
E. Square
F. Square root
G. X to the power N
E. Decimal to Binary conversion
F. Decimal to Hex conversion