Skip to main content

How to make a Calculator


Calculator  - Visual Basic 2008 / 2010
Part- 1
This tutorial will show you how to make a basic calculator:

Click on Project next to Create: 


Click on Windows Form Application, and name the project "Your name's Calculator" and then click Ok. You can change the form text to "your name's calculator". Click on the form and then go to properties window, then change the text property.
You also need to disable the maximize control of the form. That's because you don't want the user to maximize the calculator. Go to the properties window, and change the maximize box property to False:

You also need to change the FormBorderStyle property to Fixed3D
Add a button to the form and place on top of the form:
You might be surprised of this button because we should have placed a text box instead. Well, this is the cool thing about Visual Basic 2008, you can use a button to display text and results.
Now we have to change the button properties to look like a text box.
First we change it's text to "0.".
 
We align the text to be on the right. Right click on the button, click on properties. In the properties window change TextAlign to MiddleRight:
 
Choose the box in the middle right (the blue one in the image above)
Change the flat style of the button. In the properties window change flat style to Flat:
 
You also need to change the color of the button. Go to the properties window and change the backcolor property to white:
 
There is two more properties you need to change: TabStop to False and Enabled to False.


 
Your button should look like this now:




Comments

Post a Comment

Popular posts from this blog

Program_function_02

Adding two Integer number using Function. /* Adding two Integer number using Function.*/  #include <stdio.h> int sum( int x, int y); /* function prototype */ int sub( int x, int y); int mul( int x, int y); int div( int x, int y);  /* function main begins program execution */  void main( )  {     sum (5,7);     sub (10,5);     mul (10,5);     div (10,5);  } /* end main */ /* Function maximum definition */ /* x, y and z are parameters */ int sum( int x, int y) {     printf ("%d", x+y);     getch(); } /* end function maximum */ int sub( int x, int y) {     printf ("%d", x-y);     getch(); } int mul( int x, int y) {     printf ("%d", x*y);     getch(); } int div( int x, int y) {     printf (...

How to make a Calculator -(Part-4) of using Visual Basic2010

Calculator  - Visual Basic 2008 / 2010 Page 4 The Zero Button: Double click on the zero button and add the following highlighted code: Private Sub Button14_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click If Button1.Text = Label1.Text Then Button1.Text = "0." ElseIf Button1.Text = "0." Then Button1.Text = "0." ElseIf Button1.Text = "0" Then Button1.Text = "0." ElseIf Button1.Text = Label3.Text Then Button1.Text = "0." Else Button1.Text = Button1.Text & "0" End If End Sub The Decimal Button: Double click on the decimal button and add the following highlighted code: Private Sub Button15_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click If Button1.Text = "0." Then Button1.Text = "." ElseIf Button1.Text = Label3.T...

C Program01 Chap01: Area of Squre

/*Prime.Chapter_01/17 Write a program for Area of Squre*/   //document #include<stdio.h>    //Header file #include<conio.h>   //Header file Preprocessor Directive #define N 10        //Symbolic constant     void main()     //main program starts {     int area;       //variable declaration     area = N*N;     //process stmt      printf("Area of square:\n"); // o/p stmt     printf("%d", area);            // to show the output visible     getch();     return 0; }   // Program ends.