Monday 25 March 2013

Practiced writing Windows Application code using Notepad

Today, I practiced adding new forms in Windows Application, Setting properties to controls and defining event procedure manually by writing the code in Notepad.

When we use Visual Studio we are already provided with Tool Box on the left hand side of the VS. But while creating Windows Application using Notepad we need to write each and every code for placing a control on the form for setting the properties etc like BackColor, Size,Location etc.

Whenever we st a value to any property of a control under property window Visual Studio on behalf of us writes all necessary code by assigning values to the property. This code is available in the Designer.cs file. But when we write code manually the programmer himself need to write all necessary code.

ASP (Active Server Pages)

The name Asp.Net, ASP represents a dll file with the name ASP.DLL and .Net represents .Net framework.

Asp.Net is the technology available in .Net for developing Web Applications. Asp.Net is only technology and not a language hence it requires C#Net or VB.Net language for writing the code.

Web Server 
Web Server is the software i.e responsible for the following :
  • Contain all files related to your website.
  • Provide security for the webpages related to your website.
  • Accept request from the client, in the form of http request.
  • Provide response to the client in the form of http response and provide communication with others servers like database server and email server.

What happens when we double click on an event of a control in the property window ?

When we double click on an event in a property window internally a method gets generated for writing the code and this method  has a special name  Event procedure which is block of code i.e bound with an event of control and gets executed whenever an event occurs.

The code written under event procedure will be executed by the event when it occurs taking the help of a delegate.
Whenever the event occurs it will call the delegate which then execute the event procedure that it bound with the event. Because a delegate is responsible for the  execution of event procedure first the event,delegate and the event procedure should be bound with each other as following :

Syntax:
<control><event> +=new <delegate> (<event proc>)

Example :
 this.Load += new EventHandler(Form 3 Load); 

Events and delegates are predefined under BCL(evens are defined in control classes and delegates are defined under namespace) what is defined here is only an Event procedure.

After defining a Event procedure in Form class Visual Studio links the Event ,delegate and event procedure.

Note : One delegate can be used by multiple events to execute event procedure but all events will not use the same delegates where different events may use different delegates to  execute event procedures.