10 January 2013

Class Diagram in C#.Net



Introduction:
                        Class Diagrams are newly added in Visual Studio 2005 edition. They provide designers, architects and developers a graphical interface to manipulate methods, properties, fields, events for data structures like classes, interfaces, structure etc.
Let us now explore all the features of Class designer.
Creating Classes using Class Diagrams
Create New Project in Visual Studio 2008 called “Class Diagram”.
Add Class Diagram’s File in your Project. It is shown below.



Class Diagram name is Called “Maths.cd”.


Right Click on the Screen .Context menu will display






Click “Class” Menu in the Screen.


Add Class name “Calculation”.
You can also choose Access of Class using Access Drop down box.
Right Click on your Class File in the Class Diagram.
Click “Add” Menu
Click “Property” Menu if you want.  i.e:  first Name, secondName.

Note: Same Procedure for Method, struct, Field, Event.


Here, I create an Add Method for this Program.


Add Parameter for Method:

        Go to Class Details window.

        Add your parameter for your method.

        Two parameters assigned for Add method (firstValue, secondValue).

       Go to method property in the classdiagram file.

       Change the Value of false to true of the static property of the method.

       See below screen



 Go to your Calculation.cs file and add this code in the Add Method

   returnfirstValue + secondValue;
Copy and paste this code in your form_load Event
          int result = Calculation.Add(50,50);
     MessageBox.Show(result.ToString());
Result:
     100.
 Thanks for reading this article. 

Today's Quoto:
        Life is like riding a bicycle. To keep your balance, you must keep moving!
 

04 January 2013

Focus on Next Button after Clicked Previous Button Using C#.Net

            Today , we will discuss about focus on Next Button after clicked previous button using C#.net
Declare Variable
private static bool IsBtnClicked = false;
Go To Next button Property window
Select "Tab Stop"  and Change to False
Copy and Paste this below Code in your Previous Button Click Event:
IsBtnClicked = true;
if (IsBtnClicked)
{
button2.TabStop = true;
IsBtnClicked = false;
}
else
{
button2.TabStop = false;
IsBtnClicked = false;
}

03 January 2013

Focus on New Line in TextBox in C#.net

Today ,we will discuss about focus on New line in TextBox in C#.Net

Select Multiple Line option in the TextBox.
Call this Code in your TextBox KeyDown Event
if (e.KeyCode == Keys.Enter)
{
(textbox name).AppendText((textbox name).Text);
}