stu nicholls dot com | menu - Professional dropdown #3

click here
What is Form?

Form is a container of controls. Controls are the user interfaces to the applications. For example you can add text box, command button etc.
Whenever you create a new project a Form will be generated. These forms have some properties and can be edited to suit your requirement. For example the name of the form, background of the form etc. can be changed.
You can add controls to it like Text box, Command button etc. and functionality is provided to the application.
Let us now create our First Application
Start Visual studio as shown in Fig. 1

Give the file name, destination folder as shown in Fig. 2

A screen with Form appears as shown in Fig. 3

Now let us first put the text box control in the form

  1. Drag the text box from tool box to the form as shown in Fig. 4
  2. Drag the command button to the form as shown in Fig. 5

If you want, change the text of command button by changing the text to Click me or anything you want. Which is shown in Fig. 6.

So your Interfaces are added to the form. Now give functionality i.e. when you press the command button, a message say "Hello How are you?" be displayed in the text box.
To give functionality:

  1. Double click on the command button. You will get a code sheet
  2. Write the code as given which is shown in Fig. 7.
  3. Save and Run the application (F5) shown in Fig. 8

Console Application

In VB.NET Console Application is used to reduce the memory space occupied by Windows Application. Console Applications are executed on the command prompt.
To create new Console applications Click on to New Projects then select the type of the application as Console Application. Now give the name for console application which is shown in Fig. 9.

All the Console Applications by default have a module Module1 and the code is needed to be included inside Sub Main()- End Sub,which is shown in Fig.10.

Following code is the example for a console application. You can see the two lines of code is written within Sub Main() and End Sub as shown in Fig. 11.

Module Module1
Sub Main()
System.Console.WriteLine("Hello How are You?")
System.Console.WriteLine("Me Fine Thank You")
End Sub
End Module

Now this console application is executed by pressing Ctrl and F5 simultaneously. The result is displayed in a DOS Window as shown in Fig. 12 instead of on a Windows form.

<< Previous   Next>>

comments powered by Disqus
click here