Wednesday, 3 April 2013

RichTextBox ,MessageBox and Masked TextBox Control

RichTextBox control is similr to a text box but provides advanced text entry and editing features like paragragh formatting. This control provides a set of properties and methods to perform formatting of the text.

Properties
Font, BackColor, ForeColor, Wordwrap, modified
Methods
 Cut(), Copy(), Paste(),Undo(), Redo(), SelectAll(), DeselectAll()
SaveFile(String fname, RichTextBoxStream Type t)
LoadFile(String fname,RichTextBox Straem Type t)

RichTextBox Stream Type is an enum which provides with a list of formats in which we want to save the file like plain Text(for notepad), RichText(for wordpad), etc
MessageBox Control

This control is use for diplaying message within a Windows application to the end user. The type of message being displayed can be euther an alert or warning or error or information messages etc.

To display the message in messagebox we can use overloaded method show which returns value of type dialog result which tells which button has been clicked on the messagebox.

show(string msg)    
show(string msg, string title, MessageBoxButtons)
show(string msg,string title, MessageBoxButtons buttons,MessageBox icon icon)

MessageBox
buttons is an enum which will list a set of constants to  choose like what type of icon image has to be displayed on the messagebox.


Masked TextBox
 This control is an extension to text box which is provided for distinguishing between proper and improper input i.e we can take the input from the user in specified format like date, time and PNR number etc. To set the format in which the input has to be entered we are provided with property masked.  Once we select the property in property window we will find a button inside it click on it which opens a  window displaying a list of predefined formats to choose, we can either select a required format for it or choose custom and enter the input format within the masked textbox  below using zeroes.

For Example:
Railway PNR No: 000-0000000
Date                   : 00/00/00
Time                   : 00:00:00

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.