Advertisement
Guest User

Teste ESW

a guest
Mar 21st, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.28 KB | None | 0 0
  1.     Dim ano As String
  2.     Dim cilindrada As String
  3.     Dim co2 As String
  4.     Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
  5.         cilindrada = TextBox2.Text
  6.         co2 = TextBox3.Text
  7.         If RadioButton4.Checked Then
  8.             MsgBox("Este programa não pode serve para carros eletricos")
  9.             Exit Sub
  10.         End If
  11.         ano = TextBox1.Text
  12.         If ano < 2007 Then
  13.             MsgBox("O simulador so é valido para carros superiopres a 2007")
  14.             Exit Sub
  15.         End If
  16.  
  17.         If cilindrada = "" Then
  18.             MsgBox("O campo cilindrada não pode tar vazio")
  19.             Exit Sub
  20.         End If
  21.         If co2 = "" Then
  22.             MsgBox("O campo CO2 não pode tar vasio")
  23.             Exit Sub
  24.         End If
  25.         If co2 <= 90 Then
  26.             Label5.Text = "Ecológico"
  27.         ElseIf co2 > 90 And co2 <= 120 Then
  28.             Label5.Text = "Normal"
  29.         Else
  30.             Label5.Text = "Poluidor"
  31.         End If
  32.         Button1.Visible = True
  33.         Button2.Visible = True
  34.         TextBox4.Visible = True
  35.         TextBox5.Visible = True
  36.     End Sub
  37.  
  38.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  39.         Dim cl As Integer
  40.         If cilindrada < 1500 Then
  41.             cl = 5 * cilindrada - 500
  42.         Else
  43.             cl = 10 * cilindrada - 3000
  44.         End If
  45.         TextBox4.Text = cl
  46.     End Sub
  47.  
  48.     Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
  49.         Dim ca As Integer
  50.         If co2 <= 90 Then
  51.             ca = 5 * co2
  52.         ElseIf co2 > 90 And co2 <= 120 Then
  53.             ca = 10 * co2
  54.         Else
  55.             ca = 20 * co2
  56.         End If
  57.         TextBox5.Text = ca
  58.     End Sub
  59.  
  60.     Private Sub ReniciarToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ReniciarToolStripMenuItem.Click
  61.         Application.Restart()
  62.     End Sub
  63.  
  64.     Private Sub SairToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles SairToolStripMenuItem.Click
  65.         Dim resposta As String
  66.         resposta = MsgBox("Terminar", MessageBoxButtons.YesNo, MsgBoxStyle.Exclamation)
  67.         If resposta = Windows.Forms.DialogResult.Yes Then
  68.             End
  69.         End If
  70.     End Sub
  71. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement