Felicidades, es un buen programa y de momento no me ha dado demasiados problemas
Una pregunta, ¿que significa nudgear?
Una pregunta, ¿que significa nudgear?
Esta sección te permite ver todos los mensajes escritos por este usuario. Ten en cuenta que sólo puedes ver los mensajes escritos en zonas a las que tienes acceso en este momento.
Mostrar Mensajes MenúCitarEn cuanto al error es un problema de casting, usa parse y arreglado
CitarPrivate Sub CmdIgual_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdIgual.Click
If StrOper = "+" Then
TxtOper = LngValor + Int(TxtOper.Text)
End If
If StrOper = "-" Then
TxtOper = LngValor - Int(TxtOper.Text)
End If
If StrOper = "*" Then
TxtOper = LngValor * Int(TxtOper.Text)
End If
If StrOper = "/" Then
TxtOper = LngValor / Int(TxtOper.Text)
End If
End Sub
Citar
Public Class Form1
Dim Variable As String
Dim StrOper As String
Dim LngValor As Long
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
MsgBox("Gracias por usar mi calculadora")
End Sub
Private Sub CmdIgual_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdIgual.Click
If StrOper = "+" Then
TxtOper = LngValor + Int(TxtOper.Text)
End If
If StrOper = "-" Then
TxtOper = LngValor - Int(TxtOper.Text)
End If
If StrOper = "*" Then
TxtOper = LngValor * Int(TxtOper.Text)
End If
If StrOper = "/" Then
TxtOper = LngValor / Int(TxtOper.Text)
End If
End Sub
Private Sub Cmd0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd0.Click
TxtOper.Text = TxtOper.Text & "0"
End Sub
Private Sub Cmd1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd1.Click
TxtOper.Text = TxtOper.Text & "1"
End Sub
Private Sub Cmd2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd2.Click
TxtOper.Text = TxtOper.Text & "2"
End Sub
Private Sub Cmd3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd3.Click
TxtOper.Text = TxtOper.Text & "3"
End Sub
Private Sub Cmd4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd4.Click
TxtOper.Text = TxtOper.Text & "4"
End Sub
Private Sub Cmd5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd5.Click
TxtOper.Text = TxtOper.Text & "5"
End Sub
Private Sub Cmd6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd6.Click
TxtOper.Text = TxtOper.Text & "6"
End Sub
Private Sub Cmd7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd7.Click
TxtOper.Text = TxtOper.Text & "7"
End Sub
Private Sub Cmd8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd8.Click
TxtOper.Text = TxtOper.Text & "8"
End Sub
Private Sub Cmd9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cmd9.Click
TxtOper.Text = TxtOper.Text & "9"
End Sub
Private Sub CmdMultiplicacion_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdMultiplicacion.Click
StrOper = "*"
LngValor = TxtOper.Text
TxtOper.Text = ""
End Sub
Private Sub CmdSuma_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdSuma.Click
StrOper = "+"
LngValor = TxtOper.Text
TxtOper.Text = ""
End Sub
Private Sub CmdResta_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdResta.Click
StrOper = "-"
LngValor = TxtOper.Text
TxtOper.Text = ""
End Sub
Private Sub CmdDivision_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdDivision.Click
StrOper = "/"
LngValor = TxtOper.Text
TxtOper.Text = ""
End Sub
Private Sub TextBox_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtOper.TextChanged
End Sub
End Class
CitarPrivate Sub CmdIgual_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdIgual.ClickPara cada una de las expresiones en rojo me da este error:
If StrOper = "+" Then
TxtOper = LngValor + TxtOper.Text
End If
If StrOper = "-" Then
TxtOper = LngValor - TxtOper.Text
End If
If StrOper = "*" Then
TxtOper = LngValor * TxtOper.Text
End If
If StrOper = "/" Then
TxtOper = LngValor / TxtOper.Text
End If
End Sub