Wednesday, November 16, 2011

C# Windows Forms

Here we go with some basics concepts of C# Windows Forms.

Step 1:- Go to File->New->Project

Step 2:- Select your language C# and Windows Forms Application in template


Now press on the OK. You can see the your C# Window Form. This is your first form. On the Left of the visual studio you can see the toolbar which contain tools. In the next blog we will see How to add controls in our C# forms and how we can use them In the next blog we also study about solution explorer, toolbar.

C# Window application


Now above you can see C# Windows Form. To execute that project either press F5, or click
Debug -> Start Debugging.

Saturday, November 12, 2011

C# Console Output


C# Console Output


This blog will give insight of C# Console output

Console.Writeline("");

Whatever is written in the small parentheses between the double quotes will be written on to the Console screen at time of execution
Example of C# Console output CILCK HERE.

C# Console Input


Get input from user in C# Console


we are going to take a look some concepts how we can get the data from the user in C# console application.

We already used these concepts in our previous applications.

Like C# Console Calculator its uses the concept of C# console input.

To Know more about it click here

Thursday, November 3, 2011

Console Calculator

Console Application

In the previous blog we saw about sum of two number to see it again CLICK HERE
Now If you want to make console program for subtraction or multiplication then you have to only change the  operator in the previous program.

Now We are going to see how we can make a calculator in Console.

Requirements:-1 User will provide the two numbers on which action to be performed.

2. After it User will select what action(Subtraction,addition,multiplication or division) user want to perform.

Sol:- Write this code .

                Console.WriteLine("**** Enter the first number *****");
                int x = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("**** Enter the second number *****");
                int y = Convert.ToInt32(Console.ReadLine());
                Console.WriteLine("**** Enter 1 for addition  *****");
                Console.WriteLine("**** Enter 2 for subtration  *****");
                Console.WriteLine("**** Enter 3 for multification  *****");
                Console.WriteLine("**** Enter 4 for divition  *****");
                int z = Convert.ToInt32(Console.ReadLine());
                switch (z)
                {
                    case 1:
                        Console.WriteLine(x + y);
                        break;
                    case 2:
                        Console.WriteLine(x - y);
                        break;
                    case 3:
                        Console.WriteLine(x * y);
                        break;
                    case 4:
                        Console.WriteLine(x / y);
                        break;
                }

Download Calculator




Wednesday, November 2, 2011

Console Readline

Console

Console Programs

Here we are going to learn how to make some console program. In the previous blog we studied about how to make a very short console program.CLICK HERE to see it again. Now we are going to discuss some concepts of previous console program.
       We have seen Console.WriteLine() method. In it Console is a class and "WriteLine" is an method of that class. So we have a clear concept to how to write in the console but if we want a program which calculate the sum of two  number then how we can do that?
            How we can read the number from Console? There is lot methods but here we are going to use Console.ReadLine() method. We will use like

int x = Console.Readline();

NO!! the above syntex genrate an error because it return the value in the form of string so we need to convert the string value to the int value and How we shall do that?

int x = Convert.ToInt32(Console.ReadLine());

CONSOLE PROGRAM:-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Enter the first number!");
            int x = Convert.ToInt32(Console.ReadLine());
            Console.WriteLine("Enter the second number!");
            int y = Convert.ToInt32(Console.ReadLine());
            int z = x + y;
            Console.WriteLine("Result of the sum is");
            Console.WriteLine(z);

           
        }
    }
}


 Now Press CTRL+F5
to bulit without debugging

Monday, October 31, 2011

What is Console?


Console Programming

What is console in .NET? Console is like a command line interface its look like the DOS operating system
Here we are going to take a look how we can do coding for console applications.
Step 1:
Go to the visual studio and click on file->new->project->
On left side select the language you want and the right side select the console application.
At the bottom of the window there are three boxes-Name, Location and Solution Name, The very first showing the name of your project and location showing where project will save, you can change the location by browsing it.

Console
Step 2:
You can see the coding that has already done.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
           {
Console.WriteLine("Hii My First Pro");
           }
    }
}

“ Console.WriteLine("Hii My First Pro ");” Only this line is added
Console.WrightLine is use print the line on console.
Now execute the program by pressing F5
Now You can see the console written “Hii My First Pro” but it disaapear
immediately so execute by pressing ctrl+F5 or start without debugging it will stay till you press any key.

This is your first console application program.

Sunday, October 30, 2011

Whar is.NET Framework?



C# TUTORIAL- .NET Framework

What if we require to use different languages for developing a single application?

This C# tutorial will give you answer to above question. In real Life if we make a software or any application, there are different modules and those modules might have require different platform like some module can be made in C++ or may other module can be made in JavaScript or other can be in C# so the main purpose of .NET FRAMEWORK is to support different platform  Yes!! .NET FRAMEWORK support C++, C#, VB.net and even some old language like COBOL etc
                       It’s a framework where you can make application using many languages. “.NET Framework” facilitate to make a web application, window application and pretty much for web services An example for web application is “Silver light”.That can run on the browser.

To download visual studio
CLICK HERE 

If you like this post you may like to know about Console application(Next C# tutorial)   CLICK HERE