Public Class Form1
Inherits System.Windows.Forms.Form
Public sayi1 As Integer
Public sayi2 As Integer
Public sonuc As Double
Public islem As String
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
’This call is required by the Windows Form Designer.
InitializeComponent()
’Add any initialization after the InitializeComponent() call
End Sub
’Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
’Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
’NOTE: The following procedure is required by the Windows Form Designer
’It can be modified using the Windows Form Designer.
’Do not modify it using the code editor.
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Button2 As System.Windows.Forms.Button
Friend WithEvents Button3 As System.Windows.Forms.Button
Friend WithEvents Button4 As System.Windows.Forms.Button
Friend WithEvents Button5 As System.Windows.Forms.Button
Friend WithEvents Button6 As System.Windows.Forms.Button
Friend WithEvents Button7 As System.Windows.Forms.Button
Friend WithEvents Button8 As System.Windows.Forms.Button
Friend WithEvents Button9 As System.Windows.Forms.Button
Friend WithEvents Button10 As System.Windows.Forms.Button
Friend WithEvents Button11 As System.Windows.Forms.Button
Friend WithEvents Button12 As System.Windows.Forms.Button
Friend WithEvents Button13 As System.Windows.Forms.Button
Friend WithEvents Button14 As System.Windows.Forms.Button
Friend WithEvents Button15 As System.Windows.Forms.Button
Friend WithEvents Button16 As System.Windows.Forms.Button
Friend WithEvents Button17 As System.Windows.Forms.Button
Private Sub InitializeComponent()
Me.TextBox1 = New System.Windows.Forms.TextBox
Me.Button1 = New System.Windows.Forms.Button
Me.Button2 = New System.Windows.Forms.Button
Me.Button3 = New System.Windows.Forms.Button
Me.Button4 = New System.Windows.Forms.Button
Me.Button5 = New System.Windows.Forms.Button
Me.Button6 = New System.Windows.Forms.Button
Me.Button7 = New System.Windows.Forms.Button
Me.Button8 = New System.Windows.Forms.Button
Me.Button9 = New System.Windows.Forms.Button
Me.Button10 = New System.Windows.Forms.Button
Me.Button11 = New System.Windows.Forms.Button
Me.Button12 = New System.Windows.Forms.Button
Me.Button13 = New System.Windows.Forms.Button
Me.Button14 = New System.Windows.Forms.Button
Me.Button15 = New System.Windows.Forms.Button
Me.Button16 = New System.Windows.Forms.Button
Me.Button17 = New System.Windows.Forms.Button
Me.SuspendLayout()
’
’TextBox1
’
Me.TextBox1.Location = New System.Drawing.Point(56, 16)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(200, 20)
Me.TextBox1.TabIndex = 0
Me.TextBox1.Text = "lütfen bir sayi yazin"
’
’Button1
’
Me.Button1.ForeColor = System.Drawing.SystemColors.HotTrack
Me.Button1.Location = New System.Drawing.Point(56, 88)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(40, 40)
Me.Button1.TabIndex = 1
Me.Button1.Text = "1"
’
’Button2
’
Me.Button2.ForeColor = System.Drawing.SystemColors.HotTrack
Me.Button2.Location = New System.Drawing.Point(112, 88)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(40, 40)
Me.Button2.TabIndex = 2
Me.Button2.Text = "2"
’
’Button3
’
Me.Button3.ForeColor = System.Drawing.SystemColors.HotTrack
Me.Button3.Location = New System.Drawing.Point(168, 88)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(40, 40)
Me.Button3.TabIndex = 3
Me.Button3.Text = "3"
’
’Button4
’
Me.Button4.ForeColor = System.Drawing.SystemColors.HotTrack
Me.Button4.Location = New System.Drawing.Point(56, 136)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(40, 40)
Me.Button4.TabIndex = 4
Me.Button4.Text = "4"
’
’Button5
’
Me.Button5.ForeColor = System.Drawing.SystemColors.HotTrack
Me.Button5.Location = New System.Drawing.Point(112, 136)
Me.Button5.Name = "Button5"
Me.Button5.Size = New System.Drawing.Size(40, 40)
Me.Button5.TabIndex = 5
Me.Button5.Text = "5"
’
’Button6
’
Me.Button6.ForeColor = System.Drawing.SystemColors.HotTrack
Me.Button6.Location = New System.Drawing.Point(168, 136)
Me.Button6.Name = "Button6"
Me.Button6.Size = New System.Drawing.Size(40, 40)
Me.Button6.TabIndex = 6
Me.Button6.Text = "6"
’
’Button7
’
Me.Button7.ForeColor = System.Drawing.SystemColors.HotTrack
Me.Button7.Location = New System.Drawing.Point(56, 184)
Me.Button7.Name = "Button7"
Me.Button7.Size = New System.Drawing.Size(40, 40)
Me.Button7.TabIndex = 7
Me.Button7.Text = "7"
’
’Button8
’
Me.Button8.ForeColor = System.Drawing.SystemColors.HotTrack
Me.Button8.Location = New System.Drawing.Point(112, 184)
Me.Button8.Name = "Button8"
Me.Button8.Size = New System.Drawing.Size(40, 40)
Me.Button8.TabIndex = 8
Me.Button8.Text = "8"
’
’Button9
’
Me.Button9.ForeColor = System.Drawing.SystemColors.HotTrack
Me.Button9.Location = New System.Drawing.Point(168, 184)
Me.Button9.Name = "Button9"
Me.Button9.Size = New System.Drawing.Size(40, 40)
Me.Button9.TabIndex = 9
Me.Button9.Text = "9"
’
’Button10
’
Me.Button10.ForeColor = System.Drawing.Color.Firebrick
Me.Button10.Location = New System.Drawing.Point(224, 88)
Me.Button10.Name = "Button10"
Me.Button10.Size = New System.Drawing.Size(40, 32)
Me.Button10.TabIndex = 10
Me.Button10.Text = "/"
’
’Button11
’
Me.Button11.ForeColor = System.Drawing.Color.Firebrick
Me.Button11.Location = New System.Drawing.Point(224, 128)
Me.Button11.Name = "Button11"
Me.Button11.Size = New System.Drawing.Size(40, 32)
Me.Button11.TabIndex = 11
Me.Button11.Text = "*"
’
’Button12
’
Me.Button12.ForeColor = System.Drawing.Color.Firebrick
Me.Button12.Location = New System.Drawing.Point(224, 168)
Me.Button12.Name = "Button12"
Me.Button12.Size = New System.Drawing.Size(40, 32)
Me.Button12.TabIndex = 12
Me.Button12.Text = "-"
’
’Button13
’
Me.Button13.ForeColor = System.Drawing.Color.Firebrick
Me.Button13.Location = New System.Drawing.Point(224, 208)
Me.Button13.Name = "Button13"
Me.Button13.Size = New System.Drawing.Size(40, 32)
Me.Button13.TabIndex = 13
Me.Button13.Text = "+"
’
’Button14
’
Me.Button14.ForeColor = System.Drawing.Color.Firebrick
Me.Button14.Location = New System.Drawing.Point(200, 56)
Me.Button14.Name = "Button14"
Me.Button14.Size = New System.Drawing.Size(64, 24)
Me.Button14.TabIndex = 14
Me.Button14.Text = "C"
’
’Button15
’
Me.Button15.ForeColor = System.Drawing.SystemColors.HotTrack
Me.Button15.Location = New System.Drawing.Point(168, 232)
Me.Button15.Name = "Button15"
Me.Button15.Size = New System.Drawing.Size(40, 40)
Me.Button15.TabIndex = 15
Me.Button15.Text = "0"
’
’Button16
’
Me.Button16.ForeColor = System.Drawing.Color.Firebrick
Me.Button16.Location = New System.Drawing.Point(224, 248)
Me.Button16.Name = "Button16"
Me.Button16.Size = New System.Drawing.Size(40, 24)
Me.Button16.TabIndex = 16
Me.Button16.Text = "="
’
’Button17
’
Me.Button17.Location = New System.Drawing.Point(56, 232)
Me.Button17.Name = "Button17"
Me.Button17.Size = New System.Drawing.Size(96, 32)
Me.Button17.TabIndex = 17
Me.Button17.Text = "CE"
’
’Form1
’
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(496, 342)
Me.Controls.Add(Me.Button17)
Me.Controls.Add(Me.Button16)
Me.Controls.Add(Me.Button15)
Me.Controls.Add(Me.Button14)
Me.Controls.Add(Me.Button13)
Me.Controls.Add(Me.Button12)
Me.Controls.Add(Me.Button11)
Me.Controls.Add(Me.Button10)
Me.Controls.Add(Me.Button9)
Me.Controls.Add(Me.Button8)
Me.Controls.Add(Me.Button7)
Me.Controls.Add(Me.Button6)
Me.Controls.Add(Me.Button5)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "lütfen bir sayi yazin" Then
TextBox1.Clear()
Else
TextBox1.AppendText("1")
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.AppendText("2")
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
TextBox1.AppendText("3")
End Sub
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
TextBox1.AppendText("4")
End Sub
Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
TextBox1.AppendText("5")
End Sub
Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
TextBox1.AppendText("6")
End Sub
Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
TextBox1.AppendText("7")
End Sub
Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
TextBox1.AppendText("8")
End Sub
Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
TextBox1.AppendText("9")
End Sub
Private Sub Button15_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button15.Click
TextBox1.AppendText("0")
End Sub
Private Sub Button10_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button10.Click
If TextBox1.Text <> "" Then
sayi1 = TextBox1.Text
islem = "/"
TextBox1.Clear()
Else
TextBox1.Text = "lütfen bir sayi yazin."
End If
End Sub
Private Sub Button11_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button11.Click
If TextBox1.Text <> "" Then
sayi1 = TextBox1.Text
islem = "*"
TextBox1.Clear()
Else
TextBox1.Text = "lütfen bir sayi yazin."
End If
End Sub
Private Sub Button12_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button12.Click
If TextBox1.Text <> "" Then
sayi1 = TextBox1.Text
islem = "-"
TextBox1.Clear()
Else
TextBox1.Text = "lütfen bir sayi yazin."
End If
End Sub
Private Sub Button13_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button13.Click
If TextBox1.Text <> "" Then
sayi1 = TextBox1.Text
islem = "+"
TextBox1.Clear()
Else
TextBox1.Text = "lütfen bir sayi yazin."
End If
End Sub
Private Sub Button16_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button16.Click
If TextBox1.Text <> "" Then
If islem = "+" Then
sayi2 = TextBox1.Text
sonuc = sayi1 + sayi2
TextBox1.Text = sonuc
ElseIf islem = "-" Then
sayi2 = TextBox1.Text
sonuc = sayi1 - sayi2
TextBox1.Text = sonuc
ElseIf islem = "/" Then
sayi2 = TextBox1.Text
sonuc = sayi1 / sayi2
TextBox1.Text = sonuc
ElseIf islem = "*" Then
sayi2 = TextBox1.Text
sonuc = sayi1 * sayi2
TextBox1.Text = sonuc
End If
Else
TextBox1.Text = "lütfen bir sayi yazin."
End If
End Sub
Private Sub Button14_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button14.Click
TextBox1.Clear()
End Sub
Private Sub Button17_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button17.Click
If Len(TextBox1.Text) <> 0 Then
Dim yeni As String = TextBox1.Text.Remove(Len(TextBox1.Text) - 1, 1)
TextBox1.Text = yeni
End If
End Sub
End Class
Evet bir makalenin daha sonuna geldik. Bir sonraki makalemizde görü?mek üzere.