Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tutorial Making A Simple Calculator!
#1
Visual Basic Simple Calculator Tutorial

1.Open your Visual basic 2008/2010 and make new project called Calculator

2.Rename window to My First Calculator

3.Make 4 buttons with 20 size of text : 1 button : +, 2 button : - , 3 button : X , 4 Button : %

Picture :
[Image: 24czcdd.jpg]

4.Make 2 Text Boxes

Picture :
[Image: zxpnps.jpg]

5.Now make 2 labels : 1 label let it be down in the middle with no text and second label in the middle of the 2 textboxes with no text too

Codingl

6.Double click on + button and type this :



Code:
Label2.Text = "+"
Label1.Text = Val(TextBox1.Text) + Val(TextBox2.Text)

7.Double Click on The - button and type this :

Code:
Label2.Text = "-"
Label1.Text = Val(TextBox1.Text) - Val(TextBox2.Text)

8.Double click on The X button and type this :

Code:
Label2.Text = "X"
Label1.Text = Val(TextBox1.Text) * Val(TextBox2.Text)

9.Double Click on the % button and type this :

Code:
Label2.Text = "%"
Label1.Text = Val(TextBox1.Text) / Val(TextBox2.Text)

10.Test it and congratz you maded your first calculator!

Picture :

[Image: sy4bgo.jpg]

Video :

Reply

#2
how do you change the size of the text in the buttons...? lmao
Reply

#3
(08-15-2011, 01:54)TheCodKingz10 Wrote: how do you change the size of the text in the buttons...? lmao

Are you serious..., when you put the button in you can adjust it lol..

Reply

#4
change the font size?
Reply

#5
(08-15-2011, 12:18)d0h! Wrote: change the font size?

Code:
' {: Gam3rr0rZ :} '

        ' Declaration '
        Dim strFontName As String = MyBase.Font.Name ' Setup font. MyBase.Font.Name will set form's font. You can set custom font using quotes mark "", inside of "" input the valid font name(needs to be installed).
        Dim iFontSize As Integer = 12 ' Edit the value to your wanted text font size.
        Dim fsFontStyle As System.Drawing.FontStyle = FontStyle.Regular ' There are 5 font styles: Bold, italic, regular, strikeout, and underline. Edit on your own.
        Dim guTextGUnit As System.Drawing.GraphicsUnit = GraphicsUnit.Point ' Font's unit. Edit on your own.

        ' Usage '
        .Font = New Font(strFontName, iFontSize, fsFontStyle, guTextGUnit) ' Input the valid object's name before dot character.

        ' You are also able to do this using properties window from designer view.

        ' {: Gam3rr0rZ :} '
~ ~
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Making an apocalyptic themed Minecraft map AZUMIKKEL 54 29,128 08-31-2013, 02:54
Last Post: AZUMIKKEL
  [Release] Mw3 Simple External Console barata 25 22,371 06-30-2013, 16:30
Last Post: nexzhd
  Making a Heli's angles match my angles? akillj 1 2,725 06-16-2013, 15:01
Last Post: Yamato
  Simple flyable helicopter script port, could use help! akillj 0 2,537 06-15-2013, 09:20
Last Post: akillj
  Making a harrier crash into the map? akillj 6 4,949 06-09-2013, 05:57
Last Post: akillj
Brick Lesson 3: Making game in C++ Nekochan 2 3,567 06-03-2013, 15:25
Last Post: Nekochan
  Making a gametype multi-rounded? DidUknowiPwn 6 4,635 04-22-2013, 22:14
Last Post: Pozzuh
Information [Tutorial] Making MORE glass in your form. Nekochan 27 12,392 03-22-2013, 22:04
Last Post: kokole
Rainbow Lesson 1: Making game in C++ Nekochan 6 5,254 02-04-2013, 15:27
Last Post: Nekochan
Rainbow Lesson 2: Making game in C++ Nekochan 1 2,752 02-04-2013, 15:14
Last Post: Ich1994

Forum Jump:


Users browsing this thread:
2 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.