Search (Article Or Program)

16 September 2013

Create Tic Tac Toe Game


Hello Guys, I am going to show you How to Create Tic Tac Toe for 2-Players.
Before Going to start, a short description on What is Tic Tac Toe?
Tic-tac-toe (or Noughts and crossesXs and Os) is a paper and pencil for two players, X and O, who take turns marking the spaces in a 3×3 grid. The player who succeeds in placing three respective marks in a horizontal, vertical, or diagonal row wins the game.

Let's Start:

Create a New project and select windows application.Give it name and then press enter.(All of us know this step).
After that you see a blank form like that:
image1
Now add 9 buttons on your form using tools.
image2

Select button then delete the text from properties(i.e. button1,button2).Actually we want no text on buttons.
Now, Put a label on your form set backcolor according to your wish(here i choose skyblue color from properties), set textalign to middlecenter and set text to "Turn".Actually We are creating a box for showing the player's Turn.

11 September 2013

Short Intro of OOP and Its Basic Principle

What is OOP?
OOP is a design philosophy. It stands for Object Oriented Programming. Object-Oriented Programming (OOP) uses a different set of programming languages than old procedural programming languages (C, Pascal, etc.). Everything in OOP is grouped as self sustainable "objects". Hence, you gain re-usability by means of four main object-oriented programming concepts.
In order to clearly understand the object orientation, let’s take your “hand” as an example. The “hand” is a class. Your body has two objects of type hand, named left hand and right hand. Their main functions are controlled/ managed by a set of electrical signals sent through your shoulders (through an interface). So the shoulder is an interface which your body uses to interact with your hands. The hand is a well architected class. The hand is being re-used to create the left hand and the right hand by slightly changing the properties of it.

Basic Principle of oops:- There are main three core principles of  any object oriented languages.
  • ENCAPSULATION:- Encapsulation provides the ability to hide the internal details of an object from its users.The concept of encapsulation is also known as data hiding or information hiding. In c# , Encapsulation is implemented using the access modifier keywords.
  1. Public
  2. Private
  3. protected
  4. Internal
  5. Protected Internal
    • POLYMORPHISM:- It is also concept of oops. It is ability to take more than one form. An operation may exhibit different behaviour in different situations.                       Ex:-  An addition operation involving two numeric values will produce sum and the same addition operation will produce a string.If we pass parameter numeric value then method return sum(numeric value) and if we pass parameter  String then same method is return string value .this called Polymorphism.
    • INHERITANCE:-  One class can include the feature of another class by using the concept of inheritance.In c# a class can be inherit only from one class at a time.Whenever we create class that  automatic inherit from System.Object class,till the time the class is not inherited from any other class.

    Easy Guide to Method Overriding in C#


    Method Overriding in C#

    When one class inherit from another class ,all the member of parent class become the member of child class .If there is a method of parent class that we want to predefined in child class. we can implement the concept of method overriding ,it means a method overriding of parents class and child class can have same method name with same parameter but parent class method will have "VIRTUAL"Keyword and child class method have "OVERRIDE"Keyword.


    EXAMPLE:-
    ?
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    using System;
    namespace methodoverriding
    {
        class Program
        {
            static void Main(string[] args)
            {
                employee obj = new employee();
                obj.display();
                Console.ReadLine();
            }
        }
    public class cls
    {
        public virtual void display()
        {
            Console.WriteLine("hello");
        }
    }
    public class employee : cls
    {
        public override void display()
        {
            Console.WriteLine("welcome");
        }
    }
    }

    Description:- Here ,I have maked the object of employee class. The display method of only employee class will get in memory,because the "display method" of cls  class has been over-hidden by the employee class.

    Follow these steps to run this program:-

    Step1:- Open your visual studio and go File->New Project->Click Console Application.
    See it:-



    Step2:- copy the whole program code in program.cs file.
    See it:-

    Step3:-  Now Run the Application(Press F5).
    OUTPUT:-


    I hope this is helpful for you

    ref: http://www.msdotnet.co.in/2012/06/method-overriding-in-c.html

    How to Create Setup file of Windows Forms Application in VS 2010


    How to Create Setup file(.Exe File) from Windows Forms Application

    This is the most important tutorial for creating the Setup File(.exe file) from windows forms application.You can easily install it any windows computers.You can use it only windows platform.

    Now i am going to convert these windows forms application to the Setup File. Friends who have not read my previous tutorials please read  first this tutorial and download it, otherwise you will not understand correctly.For read the previous tutorial .
    There are some steps to create Setup File From windows forms applications. please follow these steps carefully. 

    Step1:-  First open your windows form application in your visual studio.Here i am using visual studio 2010 and my windows forms application Name is "test",which had made in previous tutorial.you can download it Clickdownload. 
    Now i am going to open "test" application in visual studio 2010,my "test" application is on desktop. See it carefully and open your application together.



    How can Take Print Receipt and Save the Data in Database in Windows Forms Application


    Hi friends, here i am going to make an Application "how can take Print Receipt and save data in database in windows Forms application".This project is very helpful for your Real Time Project Development and you can achieve more knowledge from this projects. You can download whole Application from the bottom of this page.
    There are some steps ,Please follow it 
    Step1:- Open your visual studio-> File->Click New Project->Select Windows Forms Application  -> Select c#language from left window->write your application name->click OK.