Wednesday, 3 April 2013

PictureBox Control

This control is use for displaying images on the UI. To display an image in the picture box first bind the image to picture box use any of the following properties:

-ImageLocation= "<path of the image>"
-Image=Image.FromFile("<path of the image>")

When we bind an image to the picture box and control how the picture box will handle image placement and control sizing we are given with property SizeMode. It is an enumerated property that can be set to any of the following:

SizeMode:
  • Normal[default]
  • Strech Image
  • AutoSize
  • CenterImage
By default, the picture box control doesn't provide any border we can use the border style property and specify what type of border the picture box control should have. This is also enumerated property that can be set to any other property.

Border Style :
  • None[default]
  • FixedSingle
  • Fixed 3D

Monday, 1 April 2013

ComboBox, ListBox and CheckListBox

We use these three controls to provide a users with the list of values to choose from.
  1.  ComboBox: It is a combination of two controls :
  • DropDown list
  • TextBox
It allows us to either select a value from the list of values as well as enter a new value in the list but provides only single selection.

     2.  ListBox: This control also provides with list of values to choose from and by default this control also support single selection only but can be customized to multi-selection by setting a property SelectionMode either as multi simple or muti extended.
  • SelectionMode[Enumerated Property]
  • None
  • One[default]
  • Multi Simple(Only Mouse Click)
  • Multi Extended(ctrl+ Mouse Click)
     3.   CheckList Box : This control also provides a list of values to choose from but it displays a checkbox beside each item from selection. By default this control supports multi-selection.

Thursday, 28 March 2013

Radio Button and Check Box


This two controls will be used when we want to provide the user with the list of values to choose from.The difference between these two controls is, radio button control is used when only a single value has to be selected from the list whereas check box is used when we want to provide multiple values to choose from list.
As a radio button supports single selection only once we select the second radio button automatically the first one gets deselected. But if we have requirement of using radio button under different places or option we need to group radio buttons by placing them on a separate container like panel, groupbox etc so that one radio button can be selected from each group.

Checked is a property provided by radio buttons and check box control to identify which control has been selected its a Boolean property that returns true if the control is not selected.

Tuesday, 26 March 2013

Creating ASP.Net Web Pages

An ASP.Net web page must have page directive at the page based on which  the web server  IIS identifies that  it is an ASP.Net page and it is also use to specify which language you want to use to write the code for ASP.Net web page.

Page Directive
<% @ page language="cs/vb"%>

An ASP.Net web page can contain HTML element, Java Script, CSS and Server Side code written using C#.Net or Vb.net language.

Server Side Code(for Single statement)
To write server side code using C#.Net or VB.Net language use the following syntax:
  <>%=stmt%>

Server Side Code(for multiple statement)
  <%
      stmt1
      stmt2
      .....
%>

Server side code(for creating reusable functions)
<script language="cs/vb" runat="server">
</script>

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.