Advertisement
mobilefish

Untitled

Aug 8th, 2020
1,648
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.39 KB | None | 0 0
  1.  
  2. Public Class Form1
  3.  
  4.     Dim Buttons As New Dictionary(Of String, Button)
  5.     Dim operand1 As Integer
  6.     Dim operand2 As Integer
  7.     Dim op As String
  8.     Dim ClearDisplay As Boolean
  9.     Dim iscreated(10) As Boolean
  10.  
  11.     Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
  12.  
  13.         Dim i As Integer
  14.         For i = 0 To 9
  15.             Dim B As New Button
  16.             Me.Controls.Add(B)
  17.             B.Width = 50
  18.             B.Height = 50
  19.             B.Text = i
  20.             Buttons.Add(B.Text, B)
  21.             B.Tag = i
  22.             AddHandler B.Click, AddressOf Button_Click
  23.         Next
  24.  
  25.     End Sub
  26.  
  27.     Private Sub Clear_Click(sender As Object, e As EventArgs) Handles Clear.Click
  28.  
  29.         Display.Text = ""
  30.  
  31.     End Sub
  32.  
  33.     Private Sub plus_Click(sender As Object, e As EventArgs) Handles plus.Click
  34.  
  35.         operand1 = Display.Text
  36.         op = "+"
  37.         Display.Text = ""
  38.  
  39.  
  40.     End Sub
  41.  
  42.     Private Sub minus_Click(sender As Object, e As EventArgs) Handles minus.Click
  43.  
  44.         operand1 = Display.Text
  45.         op = "-"
  46.         Display.Text = ""
  47.  
  48.     End Sub
  49.  
  50.     Private Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs)
  51.  
  52.         Dim B As Button = sender
  53.         B.BackColor = Color.Blue
  54.         iscreated(B.Tag) = True
  55.         MessageBox.Show(B.Text)
  56.         Display.Text = Display.Text + (B.Text)
  57.  
  58.  
  59.     End Sub
  60.  
  61. End Class
  62.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement