Código:
Public Class Calculadora
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim StrOper As String
Dim LngValor As Long
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
End Sub
Private Sub Cmd0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd0.Click
TextBox1.Text() = TextBox1.Text & "0"
End Sub
Private Sub Cmd1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd1.Click
TextBox1.Text() = TextBox1.Text & "1"
End Sub
Private Sub Cmd2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd2.Click
TextBox1.Text = TextBox1.Text & "2"
End Sub
Private Sub Cmd3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd3.Click
TextBox1.Text = TextBox1.Text & "3"
End Sub
Private Sub Cmd4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd4.Click
TextBox1.Text = TextBox1.Text & "4"
End Sub
Private Sub Cmd5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd5.Click
TextBox1.Text = TextBox1.Text & "5"
End Sub
Private Sub Cmd6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd6.Click
TextBox1.Text = TextBox1.Text & "6"
End Sub
Private Sub Cmd7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd7.Click
TextBox1.Text = TextBox1.Text & "7"
End Sub
Private Sub Cmd8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd8.Click
TextBox1.Text = TextBox1.Text & "8"
End Sub
Private Sub Cmd9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd9.Click
TextBox1.Text = TextBox1.Text & "9"
End Sub
Private Sub Cmdmas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmdmas.Click
StrOper = "+"
LngValor = TextBox1.Text
TextBox1.Text = ""
End Sub
Private Sub Cmdmenos_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmdmenos.Click
StrOper = "-"
LngValor = TextBox1.Text
TextBox1.Text = ""
End Sub
Private Sub Cmdpor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmdpor.Click
StrOper = "*"
LngValor = TextBox1.Text
TextBox1.Text = ""
End Sub
Private Sub Cmdentre_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmdentre.Click
StrOper = "/"
LngValor = TextBox1.Text
TextBox1.Text = ""
End Sub
Private Sub CmdIgual_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdIgual.Click
If StrOper = "+" Then
TextBox1 = LngValor + TextBox1.Text
End If
If StrOper = "-" Then
TextBox1 = LngValor - TextBox1.Text
End If
If StrOper = "*" Then
TextBox1 = LngValor * TextBox1.Text
End If
If StrOper = "/" Then
TextBox1 = LngValor / TextBox1.Text
End If
End Sub
End Class
Errores
Código:
Variable local sin utilizar: 'StrOper'.
Variable local sin utilizar: 'LangValor'.
Código:
No se ha declarado el nombre 'StrOper'.
No se ha declarado el nombre 'LangValor'.
Estos dos ultimos salen mucho, por cada vez que uso esas variables.