Advertisement
Aminpro

Visual Basic Calc Simple

Aug 10th, 2011
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Public Class Form3
  2.  
  3.     Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  4.  
  5.             'Created by Aminpro
  6.  
  7.             'Written by Aminpro
  8.            'LoL
  9.            'Do not steal!
  10.        'Seriously?
  11.  
  12.  
  13.  
  14.         If IsNumeric(TextBox1.Text) And IsNumeric(TextBox2.Text) Then
  15.  
  16.  
  17.  
  18.  
  19.             '_____________Declarations_________________
  20.            Dim x As Double
  21.             Dim y As Double
  22.             Dim Op As String 'Created by Aminpro
  23.  
  24.             x = CInt(TextBox1.Text)
  25.             y = CInt(TextBox2.Text)
  26.             Op = operatorbox.SelectedItem 'Created by Aminpro
  27.            '___________End Declarations_______________
  28.  
  29.             'If operations starts----------------
  30.  
  31.  
  32.             If Op = "+" Then
  33.                 ans.Text = x + y
  34.             End If 'Created by Aminpro
  35.            If Op = "-" Then
  36.                 ans.Text = x - y
  37.             End If 'Created by Aminpro
  38.            If Op = "*" Then
  39.                 ans.Text = x * y
  40.             End If 'Created by Aminpro
  41.            If Op = "/" Then
  42.                 ans.Text = x / y
  43.             End If 'Created by Aminpro
  44.            If Op = "^" Then
  45.                 ans.Text = x ^ y
  46.             End If 'Created by Aminpro'Created by Aminpro
  47.        Else
  48.  
  49.             ans.Text = "Only intergers are accepted!"
  50.         End If
  51.  
  52.  
  53.  
  54.         'If operations ends------------------
  55.  
  56.  
  57.  
  58.  
  59.  
  60.     End Sub
  61. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement