• We just launched and are currently in beta. Join us as we build and grow the community.

Simple Caculator

PSNMAFIA

CISO Advisor
P Rep
0
0
0
Rep
0
P Vouches
0
0
0
Vouches
0
Posts
128
Likes
24
Bits
2 MONTHS
2 2 MONTHS OF SERVICE
LEVEL 1 500 XP
This is a very simple calculator that allows you to calculate addition, subtraction, multiplication, and division.

  1. Public

    Class

    Form1

  2. Private

    Sub

    Button1_Click(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    Button1.

    Click

  3. If

    (

    TextBox1.

    Text

    =

    " "

    )

    Then
  4. MessageBox.

    Show

    (

    "enter value in num1"

    )
  5. End

    If
  6. If

    (

    TextBox2.

    Text

    =

    " "

    )

    Then
  7. MessageBox.

    Show

    (

    "enter value in num2"

    )
  8. Else
  9. TextBox3.

    Text

    =

    Val

    (

    TextBox1.

    Text

    )

    +

    Val

    (

    TextBox2.

    Text

    )
  10. End

    If

  11. End

    Sub

  12. Private

    Sub

    TextBox3_TextChanged(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    TextBox3.

    TextChanged

  13. End

    Sub

  14. Private

    Sub

    Button2_Click(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    Button2.

    Click

  15. If

    (

    TextBox1.

    Text

    =

    " "

    )

    Then
  16. MessageBox.

    Show

    (

    "enter value in num1"

    )
  17. End

    If
  18. If

    (

    TextBox2.

    Text

    =

    " "

    )

    Then
  19. MessageBox.

    Show

    (

    "enter value in num2"

    )
  20. Else
  21. TextBox3.

    Text

    =

    Val

    (

    TextBox1.

    Text

    )

    *

    Val

    (

    TextBox2.

    Text

    )
  22. End

    If
  23. End

    Sub

  24. Private

    Sub

    Button3_Click(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    Button3.

    Click
  25. TextBox1.

    Text

    =

    " "
  26. TextBox2.

    Text

    =

    " "

    'clear button to clear all numbers.
  27. TextBox3.

    Text

    =

    " "



  28. End

    Sub

  29. Private

    Sub

    Button4_Click(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    Button4.

    Click
  30. Form2.

    Show

    (

    )

    'show exit form.
  31. End

    Sub


  32. Private

    Sub

    abstract_Click(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    abstract.

    Click
  33. If

    (

    TextBox1.

    Text

    =

    " "

    )

    Then
  34. MessageBox.

    Show

    (

    "enter value in num1"

    )
  35. End

    If
  36. If

    (

    TextBox2.

    Text

    =

    " "

    )

    Then
  37. MessageBox.

    Show

    (

    "enter value in num2"

    )
  38. Else
  39. TextBox3.

    Text

    =

    Val

    (

    TextBox1.

    Text

    )

    -

    Val

    (

    TextBox2.

    Text

    )
  40. End

    If

  41. End

    Sub

  42. Private

    Sub

    division_Click(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    division.

    Click
  43. If

    (

    TextBox1.

    Text

    =

    " "

    )

    Then
  44. MessageBox.

    Show

    (

    "enter value in num1"

    )
  45. End

    If
  46. If

    (

    TextBox2.

    Text

    =

    " "

    )

    Then
  47. MessageBox.

    Show

    (

    "enter value in num2"

    )
  48. Else
  49. TextBox3.

    Text

    =

    Val

    (

    TextBox1.

    Text

    )

    /

    Val

    (

    TextBox2.

    Text

    )
  50. End

    If
  51. End

    Sub

  52. Private

    Sub

    TextBox4_TextChanged(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

  53. End

    Sub
  54. End

    Class

  55. Public

    Class

    Form2

  56. Private

    Sub

    Button2_Click(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    Button2.

    Click
  57. Me

    .

    Close

    (

    )

    ' if no button close form2 &keep app on.



  58. End

    Sub

  59. Private

    Sub

    Button1_Click(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    Button1.

    Click

  60. Form1.

    Close

    (

    )

    'close form1.

  61. Me

    .

    Close

    (

    )

    'close form2 .



  62. End

    Sub

  63. Private

    Sub

    Form2_Load(

    ByVal

    sender As

    System.

    Object

    , ByVal

    e As

    System.

    EventArgs

    )

    Handles

    MyBase

    .

    Load

  64. End

    Sub
  65. End

    Class

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.

FOR YOUR OWN SAFETY, PLEASE:

1. Re-scan downloaded files using your personal virus checker before using it.

2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.


Download
You must upgrade your account or reply in the thread to view hidden text.
 

452,292

323,526

323,535

Top