How can i alternate two buttons, to send a value to the same textbox? if one button not made the math of the value, then receive the value from the ma

  • Thread starter Thread starter Gustavo Nikov
  • Start date Start date
G

Gustavo Nikov

Guest
So, i make this script, that calculates time of concentration of one area, but, the user can user two methods tu calculate, will depende on the informations that he have, if he calculate by one math and click the button to make the math, than send the value to my textbox, but i wanna put a conditional option that, if button1 don't realize the procedure, and the other does, than the value of the math made by button2 can fill the textbox, in other words, i wanna put value receive by textboxes = Value from the button1 or value from the button 2, but the OR doesn't work for this things. This is my script( the script works, but just for button 1):

Private Sub CALCULAR(sender As Object, e As EventArgs) Handles CALCULAR1.Click, CALCULAR2.Click


'Concentration time calculation from button1
Precip24 = P24.Text
Compr1 = L1.Text
Decliv1 = S1.Text
Manning1 = N1.Text
Operacao1 = 5.474 * ((Manning1 * Compr1) ^ 0.8) / (Precip24 ^ 0.5 * Decliv1 ^ 0.4)

'textbox receives the value of operacao1

'next time that someone press the button, the value of operacao1 goes to tc2.text and so on

count += 1
If count >= 11 Then MsgBox("O Limite foi alcançado")
CType((Resultados.Controls("tc" & count.ToString())), TextBox).Text = Operacao1

If MsgBox("Cálculo realizado com sucesso") Then
P24.Text = 0
L1.Text = 0
S1.Text = 0
N1.Text = 0
End If
'Concetration time calculation from button 2
RaioH = RH.Text
Compr2 = L2.Text
Decliv2 = S2.Text
Manning2 = N2.Text
Vel = V.Text
If V.Text = 0 Then
Operacao2 = (RaioH ^ (2 / 3) * System.Math.Sqrt(Decliv2)) / Manning2

Else Operacao2 = Compr2 / Vel

End If

If MsgBox("Cálculo realizado com sucesso") Then
RH.Text = 0
L2.Text = 0
S2.Text = 0
N2.Text = 0
V.Text = 0
End If

Continue reading...
 
Back
Top