Visual Basic - Calculadora bucle repetitivo

Life is soft - evento anual de software empresarial
 
Vista:

Calculadora bucle repetitivo

Publicado por freddy (2 intervenciones) el 16/05/2019 16:04:55
Hola necesito ayuda,

Miren no he logrado encontrar una lógica para que en una calculadora me opere mas de dos numeros en bucle repetitivo en visual basic (Recuerden que una calculadora no sabe cuantos números ingresarán=)

si me ayudaran se los agradeceria
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de Andres Leonardo
Val: 3.117
Oro
Ha mantenido su posición en Visual Basic (en relación al último mes)
Gráfica de Visual Basic

Calculadora bucle repetitivo

Publicado por Andres Leonardo (1798 intervenciones) el 16/05/2019 16:28:37
Hola Freddy

Seria importante nos indiques un ejemplo de lo que necesitas .... si puedes sube un lubro y revisamos que podemos hacer

Saludos
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Calculadora bucle repetitivo

Publicado por freddy (2 intervenciones) el 16/05/2019 17:02:12
Necesito meter cada sentencia del procedimiento Calcu debe ir en un bucle para que me opere mas de dos numeros

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
Public Sub Calcu()
        Select Case signo
            Case "+"
                  // aqui me debe sumas mas de dos numeros
                TextBox1.Text = operacion1 + operacion2
 
            Case "-"
                  // aqui me debe restar mas de dos numeros
                TextBox1.Text = operacion1 - operacion2
 
            Case "*"
                  // aqui me debe multiplicar mas de dos numeros
                TextBox1.Text = operacion1 * operacion2
 
            Case "/"
                TextBox1.Text = operacion1 / operacion2
 
            Case "raiz"
                TextBox1.Text = operacion1 ^ (1 / 2)
 
            Case "exponente"
                TextBox1.Text = operacion1 ^ operacion2
 
            Case "%"
                TextBox1.Text = operacion1 * operacion2 / 100
        End Select
 
    End Sub
 
    Public Sub cocncatenar()
        If bandera = True Then
            TextBox1.Text = ""
            bandera = False
 
        End If
    End Sub
 
 
    Private Sub Button20_Click(sender As Object, e As EventArgs) Handles Button20.Click
        cocncatenar()
        If Button1.Enabled = True Then
            TextBox1.Text = TextBox1.Text & "1"
        End If
    End Sub
 
    Private Sub Button19_Click(sender As Object, e As EventArgs) Handles Button19.Click
        cocncatenar()
        If Button1.Enabled = True Then
            TextBox1.Text = TextBox1.Text & "2"
        End If
    End Sub
 
    Private Sub Button18_Click(sender As Object, e As EventArgs) Handles Button18.Click
        cocncatenar()
        If Button1.Enabled = True Then
            TextBox1.Text = TextBox1.Text & "3"
        End If
    End Sub
 
    Private Sub Button15_Click(sender As Object, e As EventArgs) Handles Button15.Click
        cocncatenar()
        If Button1.Enabled = True Then
            TextBox1.Text = TextBox1.Text & "4"
        End If
    End Sub
 
    Private Sub Button14_Click(sender As Object, e As EventArgs) Handles Button14.Click
        cocncatenar()
        If Button1.Enabled = True Then
            TextBox1.Text = TextBox1.Text & "5"
        End If
    End Sub
 
    Private Sub Button13_Click(sender As Object, e As EventArgs) Handles Button13.Click
        cocncatenar()
        If Button1.Enabled = True Then
            TextBox1.Text = TextBox1.Text & "6"
        End If
    End Sub
 
    Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click
        cocncatenar()
        If Button1.Enabled = True Then
            TextBox1.Text = TextBox1.Text & "7"
        End If
    End Sub
 
    Private Sub Button9_Click(sender As Object, e As EventArgs) Handles Button9.Click
        cocncatenar()
        If Button1.Enabled = True Then
            TextBox1.Text = TextBox1.Text & "8"
        End If
    End Sub
 
    Private Sub Button8_Click(sender As Object, e As EventArgs) Handles Button8.Click
        cocncatenar()
        If Button1.Enabled = True Then
            TextBox1.Text = TextBox1.Text & "9"
        End If
    End Sub
 
    Private Sub Button25_Click(sender As Object, e As EventArgs) Handles Button25.Click
        cocncatenar()
        If Button1.Enabled = True Then
            TextBox1.Text = TextBox1.Text & "0"
        End If
    End Sub
 
    Private Sub Button23_Click(sender As Object, e As EventArgs) Handles Button23.Click
 
        If InStr(TextBox1.Text, ".", CompareMethod.Text) = 0 Then
            TextBox1.Text = TextBox1.Text & "."
        End If
    End Sub
 
    Private Sub Button22_Click(sender As Object, e As EventArgs) Handles Button22.Click
        If TextBox1.Text <> "" Then
            operacion1 = Val(TextBox1.Text)
            signo = "+"
            bandera = True
        End If
    End Sub
 
    Private Sub Button17_Click(sender As Object, e As EventArgs) Handles Button17.Click
        If TextBox1.Text <> "" Then
            operacion1 = Val(TextBox1.Text)
            signo = "-"
            bandera = True
        End If
 
    End Sub
 
    Private Sub Button12_Click(sender As Object, e As EventArgs) Handles Button12.Click
        If TextBox1.Text <> "" Then
            operacion1 = Val(TextBox1.Text)
            signo = "*"
            bandera = True
        End If
 
    End Sub
 
    Private Sub Button7_Click(sender As Object, e As EventArgs) Handles Button7.Click
        If TextBox1.Text <> "" Then
            operacion1 = Val(TextBox1.Text)
            signo = "/"
            bandera = True
        End If
 
    End Sub
 
    Private Sub Button5_Click(sender As Object, e As EventArgs) Handles Button5.Click
        If TextBox1.Text <> "" Then
            operacion1 = Val(TextBox1.Text)
            signo = "raiz"
            bandera = True
        End If
 
    End Sub
 
    Private Sub Button6_Click(sender As Object, e As EventArgs) Handles Button6.Click
        If TextBox1.Text <> "" Then
            operacion1 = Val(TextBox1.Text)
            signo = "exponente"
            bandera = True
        End If
 
    End Sub
 
    Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
        If TextBox1.Text <> "" Then
            operacion1 = Val(TextBox1.Text)
            signo = "%"
            bandera = True
        End If
 
    End Sub
 
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        TextBox1.Clear()
        operacion1 = 0.0
        operacion2 = 0.0
        signo = String.Empty
    End Sub
 
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Try
            Dim lange As Integer
            If TextBox1.Text <> "" Then
                lange = TextBox1.Text.Length
                TextBox1.Text = Mid(TextBox1.Text, 1, lange - 1)
 
 
            End If
        Catch ex As Exception
 
        End Try
    End Sub
 
    Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
        Try
            If TextBox1.Text <> "" Then
                TextBox1.Text = TextBox1.Text * -1
            End If
        Catch ex As Exception
 
        End Try
    End Sub
 
    Private Sub Button11_Click(sender As Object, e As EventArgs) Handles Button11.Click
        Try
            If TextBox1.Text <> "" Then
                TextBox1.Text = 1 / (TextBox1.Text)
 
            End If
        Catch ex As Exception
 
        End Try
 
    End Sub
 
    Private Sub Button16_Click(sender As Object, e As EventArgs) Handles Button16.Click
        If TextBox1.Text <> "" And operacion1 <> 0.0 Then
            operacion2 = TextBox1.Text
            Calcu()
 
        End If
    End Sub
End Class
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar