Page 1 of 3 123 LastLast
Results 1 to 15 of 33
  1. #1
    hopefordope's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    Herndon,VA
    Posts
    264
    Reputation
    9
    Thanks
    86
    My Mood
    Psychedelic

    Arrow [TUT]How to make a Calculator

    Credits to: RFB
    Calculator - Visual Basic 2008

    Hey guys this my first TUT on VB. in this TUT i will teach you how to make a Basic calculator

    This tutorial will show you how to make a basic calculator:

    Open Visual Basic 2008 Express Edition. (If you don't have the program click here to download it for free.)

    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 textbox 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:





    Let's add the rest of the buttons to the form.

    Important: please add the button in the same order exactly as shown below.



    Add four buttons. Start by adding the button on the left (1) then (2) then (3) then (4)

    Change the text of the four buttons to 7 , 8, 9, / as shown above.

    Add four more buttons and change their text to 4, 5, 6, *

    Remember to start adding the buttons in order as the following image:



    Add four more buttons in the same order as shown below and change their text to 1, 2, 3, -



    Add four more buttons in the same order as shown below and change their text to 0, . , =, +



    Add the last two buttons to the calculator in order as shown below and change their text to Clear, Exit:





    Before we start adding the codes, we should add three labels to the form. These labels are going to be hidden beyond the calculator's borders and they will hold the numbers during the mathematical operations.

    Add three labels to the form and place them under the bottom buttons:



    Resize the calculator to from the bottom to hide the labels as follows:



    We start adding the codes now:

    Let's start programming a button at a time:

    The Clear Button:

    Double click on the Clear Button and add the following highlighted code:

    Code:
    Private Sub Button18_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button18.Click
    
    Button1.Text = "0."
    
    Label1.Text = ""
    
    Label2.Text = ""
    
    Label3.Text = ""
    
    End Sub
    The Exit Button:

    Double click on the Exit Button and add the following highlighted code:

    Code:
    Private Sub Button19_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button19.Click
    
    End
    
    End Sub
    The Equal Button "=":

    Double click on the equal button and add the following highlighted code:

    Code:
    Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
    
    If Label1.Text > "" And Label2.Text = "+" Then
    
    Button1.Text = Val(Label1.Text) + Val(Button1.Text)
    
    Label3.Text = Button1.Text
    
    ElseIf Label2.Text > "" And Label2.Text = "-" Then
    
    Button1.Text = Val(Label1.Text) - Val(Button1.Text)
    
    Label3.Text = Button1.Text
    
    ElseIf Label2.Text > "" And Label2.Text = "*" Then
    
    Button1.Text = Val(Label1.Text) * Val(Button1.Text)
    
    Label3.Text = Button1.Text
    
    ElseIf Label2.Text > "" And Label2.Text = "/" Then
    
    Button1.Text = Val(Label1.Text) / Val(Button1.Text)
    
    Label3.Text = Button1.Text
    
    Else
    
    End If
    
    End Sub
    The Addition Button:

    Double click on the plus button and add the following highlighted code:

    Code:
    Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
    
    Label2.Text = "+"
    
    Label1.Text = Button1.Text
    
    End Sub
    The Subtraction Button:

    Double click on the subtract button and add the following highlighted code:

    Code:
    Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
    
    Label2.Text = "-"
    
    Label1.Text = Button1.Text
    
    End Sub
    The Multiplication Button

    Double click on the multiplication button and add the following highlighted code:

    Code:
    Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
    
    Label2.Text = "*"
    
    Label1.Text = Button1.Text
    End Sub

    The Division Button:

    Double click on the division button and add the following highlighted code:

    Code:
    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
    
    Label2.Text = "/"
    
    Label1.Text = Button1.Text
    
    End Sub
    The Zero Button:

    Double click on the zero button and add the following highlighted code:

    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:

    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.Text Then
    
    Button1.Text = "."
    
    ElseIf Button1.Text = Label1.Text Then
    
    Button1.Text = "."
    
    Else
    
    If Button1.Tex*****ntains(".") Then
    
    Else
    
    Button1.Text = Button1.Text & "."
    
    End If
    
     
    
    End If
    
    End Sub
    The One Button:

    Double click on the one button and add the following highlighted code:

    Code:
    Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
    
    If Button1.Text = Label1.Text Then
    
    Button1.Text = "1"
    
    ElseIf Button1.Text = "0." Then
    
    Button1.Text = "1"
    
    ElseIf Button1.Text = Label3.Text Then
    
    Button1.Text = "1"
    
    Else
    
    Button1.Text = Button1.Text & "1"
    
    End If
    
    End Sub
    The Two Button:

    Double click on the two button and add the following highlighted code:

    Code:
    Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
    
    If Button1.Text = Label1.Text Then
    
    Button1.Text = "2"
    
    ElseIf Button1.Text = "0." Then
    
    Button1.Text = "2"
    
    ElseIf Button1.Text = Label3.Text Then
    
    Button1.Text = "2"
    
    Else
    
    Button1.Text = Button1.Text & "2"
    
    End If
    
    End Sub
    The Three Button:

    Double click on the three button and add the following highlighted code:

    Code:
    Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
    
    If Button1.Text = Label1.Text Then
    
    Button1.Text = "3"
    
    ElseIf Button1.Text = "0." Then
    
    Button1.Text = "3"
    
    ElseIf Button1.Text = Label3.Text Then
    
    Button1.Text = "3"
    
    Else
    
    Button1.Text = Button1.Text & "3"
    
    End If
    
    End Sub
    The Four Button:

    Double click on the four button and add the following highlighted code:

    Code:
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    
    If Button1.Text = Label1.Text Then
    
    Button1.Text = "4"
    
    ElseIf Button1.Text = "0." Then
    
    Button1.Text = "4"
    
    ElseIf Button1.Text = Label3.Text Then
    
    Button1.Text = "4"
    
    Else
    
    Button1.Text = Button1.Text & "4"
    
    End If
    
    End Sub
    the 5 button
    Code:
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    
    If Button1.Text = Label1.Text Then
    
    Button1.Text = "5"
    
    ElseIf Button1.Text = "0." Then
    
    Button1.Text = "5"
    
    ElseIf Button1.Text = Label3.Text Then
    
    Button1.Text = "5"
    
    Else
    
    Button1.Text = Button1.Text & "5"
    
    End If
    
    End Sub
    the 6 button

    Code:
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    
    If Button1.Text = Label1.Text Then
    
    Button1.Text = "6"
    
    ElseIf Button1.Text = "0." Then
    
    Button1.Text = "6"
    
    ElseIf Button1.Text = Label3.Text Then
    
    Button1.Text = "6"
    
    Else
    
    Button1.Text = Button1.Text & "6"
    
    End If
    
    End Sub
    the 7 button

    Code:
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    
    If Button1.Text = Label1.Text Then
    
    Button1.Text = "7"
    
    ElseIf Button1.Text = "0." Then
    
    Button1.Text = "7"
    
    ElseIf Button1.Text = Label3.Text Then
    
    Button1.Text = "7"
    
    Else
    
    Button1.Text = Button1.Text & "7"
    
    End If
    
    End Sub
    button 8

    Code:
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    
    If Button1.Text = Label1.Text Then
    
    Button1.Text = "8"
    
    ElseIf Button1.Text = "0." Then
    
    Button1.Text = "8"
    
    ElseIf Button1.Text = Label3.Text Then
    
    Button1.Text = "8"
    
    Else
    
    Button1.Text = Button1.Text & "8"
    
    End If
    
    End Sub
    and last but not least the 9 button

    Code:
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    
    If Button1.Text = Label1.Text Then
    
    Button1.Text = "9"
    
    ElseIf Button1.Text = "0." Then
    
    Button1.Text = "9"
    
    ElseIf Button1.Text = Label3.Text Then
    
    Button1.Text = "9"
    
    Else
    
    Button1.Text = Button1.Text & "9"
    
    End If
    
    End Sub

    WELL THAT ENDS MY SUPER LONG TUT ON HOW TO A BASIC CALCULATOR
    THIS TUT IS MADE VERY NOOB FRIENDLY BUT IF YOU STILL HAVE A QUESTION THEN PLZ HESITATE TO ASK
    THANK YOU!!!
    Last edited by why06; 02-17-2010 at 07:23 AM. Reason: finsihed

    Press Thank You[IMG]https://i45.tinypic.com/2hg8w0n.jpghttps://img1.UploadScreensho*****m/images/main/2/3203234450.jpg[/IMG]










    My Releases
    Injector 3G
    Injector 2G
    Injector 1G
    Super Spammer
    CA Cleaner
    My Tutorials
    How to Make a real Injector(PerX)
    How to Make a Calculator(leeched)

  2. The Following 7 Users Say Thank You to hopefordope For This Useful Post:

    -MODZ- (07-03-2013),DayumKen (06-22-2010),Houston (02-17-2010),juniorvb (09-28-2011),NOOBJr (03-24-2011),Shadeyz346 (05-24-2011),zmansquared (02-14-2010)

  3. #2
    zmansquared's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Location
    Kickin it at Microsoft
    Posts
    2,086
    Reputation
    36
    Thanks
    221
    My Mood
    Cheerful
    wow thats alot. thanks very helpful
    Need Help With Coding or Something??? MSN me
    zmansquared@hotmail.com


    I am the one and only Microsoft Fag!!!

    Quote:
    Originally Posted by Arhk
    All games should be hacked, if we don't do it someone else will. Hackers force the progress, of better programming methods.
    ~


    Take this Pic everyone!



    next-

  4. #3
    hopefordope's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    Herndon,VA
    Posts
    264
    Reputation
    9
    Thanks
    86
    My Mood
    Psychedelic
    lol took me .............32.17 mins lol i timed it

    Press Thank You[IMG]https://i45.tinypic.com/2hg8w0n.jpghttps://img1.UploadScreensho*****m/images/main/2/3203234450.jpg[/IMG]










    My Releases
    Injector 3G
    Injector 2G
    Injector 1G
    Super Spammer
    CA Cleaner
    My Tutorials
    How to Make a real Injector(PerX)
    How to Make a Calculator(leeched)

  5. #4
    cpepablito's Avatar
    Join Date
    Mar 2009
    Gender
    male
    Location
    Under your bed
    Posts
    2,582
    Reputation
    2
    Thanks
    171
    My Mood
    Angelic
    Nice always wanted to make one

  6. #5
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Not bad at all


     


     


     



    The Most complete application MPGH will ever offer - 68%




  7. #6
    zmansquared's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Location
    Kickin it at Microsoft
    Posts
    2,086
    Reputation
    36
    Thanks
    221
    My Mood
    Cheerful
    ill try and make a tut on a spam bot or something dumb. :P i am no nextgen1 or lolland
    Need Help With Coding or Something??? MSN me
    zmansquared@hotmail.com


    I am the one and only Microsoft Fag!!!

    Quote:
    Originally Posted by Arhk
    All games should be hacked, if we don't do it someone else will. Hackers force the progress, of better programming methods.
    ~


    Take this Pic everyone!



    next-

  8. #7
    hopefordope's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    Herndon,VA
    Posts
    264
    Reputation
    9
    Thanks
    86
    My Mood
    Psychedelic
    Yeah those two ppl are pimps at vb and lolland is only thirteen

    Press Thank You[IMG]https://i45.tinypic.com/2hg8w0n.jpghttps://img1.UploadScreensho*****m/images/main/2/3203234450.jpg[/IMG]










    My Releases
    Injector 3G
    Injector 2G
    Injector 1G
    Super Spammer
    CA Cleaner
    My Tutorials
    How to Make a real Injector(PerX)
    How to Make a Calculator(leeched)

  9. #8
    zmansquared's Avatar
    Join Date
    Oct 2008
    Gender
    male
    Location
    Kickin it at Microsoft
    Posts
    2,086
    Reputation
    36
    Thanks
    221
    My Mood
    Cheerful
    wow, really
    Need Help With Coding or Something??? MSN me
    zmansquared@hotmail.com


    I am the one and only Microsoft Fag!!!

    Quote:
    Originally Posted by Arhk
    All games should be hacked, if we don't do it someone else will. Hackers force the progress, of better programming methods.
    ~


    Take this Pic everyone!



    next-

  10. #9
    hopefordope's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    Herndon,VA
    Posts
    264
    Reputation
    9
    Thanks
    86
    My Mood
    Psychedelic
    Yeah i figured frm his voice on one of the vid tut

    Press Thank You[IMG]https://i45.tinypic.com/2hg8w0n.jpghttps://img1.UploadScreensho*****m/images/main/2/3203234450.jpg[/IMG]










    My Releases
    Injector 3G
    Injector 2G
    Injector 1G
    Super Spammer
    CA Cleaner
    My Tutorials
    How to Make a real Injector(PerX)
    How to Make a Calculator(leeched)

  11. #10
    hopefordope's Avatar
    Join Date
    Aug 2009
    Gender
    male
    Location
    Herndon,VA
    Posts
    264
    Reputation
    9
    Thanks
    86
    My Mood
    Psychedelic
    Omg i forgot to write the other button codes

    Press Thank You[IMG]https://i45.tinypic.com/2hg8w0n.jpghttps://img1.UploadScreensho*****m/images/main/2/3203234450.jpg[/IMG]










    My Releases
    Injector 3G
    Injector 2G
    Injector 1G
    Super Spammer
    CA Cleaner
    My Tutorials
    How to Make a real Injector(PerX)
    How to Make a Calculator(leeched)

  12. #11
    mnpeepno2's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    In a barren wasteland
    Posts
    905
    Reputation
    10
    Thanks
    81
    ill make a more complex one and post it here.


    -----------------------------------------------

    My site: here
    My Blog: here
    My member's area: here
    Minecraft Sever Forum: here


    Minecraft Servers:

    Public:



    Private:



  13. #12
    deathninjak0's Avatar
    Join Date
    Feb 2009
    Gender
    male
    Posts
    1,510
    Reputation
    12
    Thanks
    294
    My Mood
    Cool
    GIVE CREDITS TO RFB!!! YOU DID NOT MAKE THE TUT!!!

    https://www.reflectionforbrain.com/form/CalculatorT.htm

  14. #13
    NextGen1's Avatar
    Join Date
    Dec 2009
    Gender
    male
    Location
    Not sure really.
    Posts
    6,312
    Reputation
    382
    Thanks
    3,019
    My Mood
    Amazed
    Good Catch


     


     


     



    The Most complete application MPGH will ever offer - 68%




  15. #14
    treeham's Avatar
    Join Date
    Apr 2009
    Gender
    male
    Location
    heh. Turn around.
    Posts
    200
    Reputation
    10
    Thanks
    41
    My Mood
    Cynical
    Just when you think they did sonething smart...
    In Choob Language:
    also for all your info.. i didnt copy and paste shit.. coz i dont think anyone has realeased any source code for the New update of CA.. so sdfu..
    In English:
    I didn't copy and paste because no one has released what I need copy and paste
    Oh Choobs...

  16. The Following User Says Thank You to treeham For This Useful Post:

    NextGen1 (02-15-2010)

  17. #15
    Bombsaway707's Avatar
    Join Date
    Jun 2009
    Gender
    male
    Location
    Gym
    Posts
    8,799
    Reputation
    791
    Thanks
    4,004
    My Mood
    Amused
    Nice TUT, very long though :P

Page 1 of 3 123 LastLast