programa de visual basic

LENGUAJE DE PROGRAMACION II PROGRAMA DE CALCULO DE CALIFICACIONES, ENTREGA 2 Public Class Form2 Dim total1, total2, tot

Views 129 Downloads 4 File size 220KB

Report DMCA / Copyright

DOWNLOAD FILE

Recommend stories

Citation preview

LENGUAJE DE PROGRAMACION II PROGRAMA DE CALCULO DE CALIFICACIONES, ENTREGA 2

Public Class Form2 Dim total1, total2, total3, nota_final As Double Dim exa1, exa2, exa3, acum1, acum2, acum3 As Double Private Sub txt_ex1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_ex1.LostFocus If txt_ex1.Text = Nothing Then 'Si el textbox no tiene informacion ErrorProvider1.SetError(txt_ex1, "Ingrese un valor numerico....") txt_ex1.Focus() Else 'Si hay informacion en el textbox ErrorProvider1.SetError(txt_ex1, Nothing) If txt_ex1.Text > 70 Then 'Si excede del rango permitido ErrorProvider1.SetError(txt_ex1, "Nota no debe ser mayor a 70....") txt_ex1.Clear() txt_ex1.Focus() Else 'Si no excede del rango permitido ErrorProvider1.SetError(txt_ex1, Nothing) txt_acum1.Enabled = True txt_acum1.Focus() End If End If End Sub Private Sub txt_acum1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_acum1.LostFocus If txt_acum1.Text = Nothing Then ErrorProvider1.SetError(txt_acum1, "Ingrese un valor numerico....") txt_acum1.Focus() Else ErrorProvider1.SetError(txt_acum1, Nothing) If txt_acum1.Text > 30 Then 'Si excede del rango permitido ErrorProvider1.SetError(txt_acum1, "Nota no debe ser mayor a 30....") txt_acum1.Clear() txt_acum1.Focus() Else 'Si no excede del rango permitido 'Asignacion de valor a las variables 'Se asigna el valor de los textbox exa1 = txt_ex1.Text acum1 = txt_acum1.Text txt_ex2.Enabled = True txt_ex2.Focus() End If End If End Sub

Private Sub txt_ex2_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_ex2.LostFocus If txt_ex2.Text = Nothing Then ErrorProvider1.SetError(txt_ex2, "Ingrese un valor numerico....") txt_ex2.Focus() Else ErrorProvider1.SetError(txt_ex2, Nothing) txt_acum2.Enabled = True txt_acum2.Focus() End If End Sub Private Sub txt_acum2_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_acum2.LostFocus If txt_acum2.Text = Nothing Then ErrorProvider1.SetError(txt_acum2, "Ingrese un valor numerico....") txt_acum2.Focus() Else ErrorProvider1.SetError(txt_acum2, Nothing) 'Asignacion de valor a las variables 'Se asigna el valor de los textbox exa2 = txt_ex2.Text acum2 = txt_acum2.Text txt_ex3.Enabled = True txt_ex3.Focus() End If End Sub Private Sub txt_ex3_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_ex3.LostFocus If txt_ex3.Text = Nothing Then ErrorProvider1.SetError(txt_ex3, "Ingrese un valor numerico....") txt_ex3.Focus() Else ErrorProvider1.SetError(txt_ex3, Nothing) txt_acum3.Enabled = True txt_acum3.Focus() End If End Sub Private Sub btn_calcular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_calcular.Click 'Calcular total del parcial 1 total1 = (exa1 + acum1) * 0.25 'Mostrar en pantalla el resultado txt_total1.Text = total1 'Calcular total del parcial total2 = (exa2 + acum2) * 0.35 'Enviar resultado al textbox total txt_total2.Text = total2 'Calcular total del parcial 3 total3 = (exa3 + acum3) * 0.4 'Enviar resultado al textbox total txt_total3.Text = total3 'Calcular nota final

nota_final = total1 + total2 + total3 txt_notaf.Text = nota_final End Sub Private Sub txt_acum3_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_acum3.LostFocus If txt_acum3.Text = Nothing Then ErrorProvider1.SetError(txt_acum3, "Ingrese un valor numerico....") txt_acum3.Focus() Else ErrorProvider1.SetError(txt_acum2, Nothing) 'Asignacion de valor a las variables 'Se asigna el valor de los textbox exa3 = txt_ex3.Text acum3 = txt_acum3.Text End If End Sub End Class