Posts

Showing posts from October, 2011

Calling the UserControl Event from the WebForm

Image
The main theme behind this article is give the clear idea about the event and the event handling in .NET.
An event is a message sent by an object to signal the occurrence of an action. This action caused by the user interaction such as button click,mouse click e.t.c.The Object that send the event is called the event sender. The object that receives the event and respond according to that is called the event receiver.

Actually in communication between the sender and the receiver ,the sender does not know which method or object will receive the event it raises. The mediator between these two is called “Delegate”.

A delegate is a class that can hold a reference to a method .The Delegate class has a signature and it can hold the reference only to the methods that match to its signature.
Normally I found the requirement to save the main page data in the user control button click which led me to write this article.
Here I have taken a user control which contains a text box…

Passing Command Line Arguments Using VS 2010

Image
Command line arguments are helpful to provide those parameters without exposing them to everybody.


Even with modern UI, we often need a way to start our programs with specific parameters. Command line arguments are helpful to provide those parameters without exposing them to everybody. When developing with .NET and C# you can get the command line arguments from your Main(string[] Args) function. Args is in fact an array containing all the strings separated by spaces entered in the command line.
Suppose we have the application which accepts some command line parameters to do some operations.We know how to pass the parameters from command prompt.I have that also some sample here.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication2010
{
class CommandLineArgument
    {
staticvoid Main(string[] arguments)
        {
            foreach (String arg in Environment.GetCommandLineArgs())
            {
Console.Write(arg);
       …