Public Class Form1
Inherits System.Windows.Forms.Form
Public KeyAscii As
Short
Dim sexo As
String
Dim Random As
New Random()
Dim numero As
Integer = Random.Next(1, 400)
Dim especialidad As Integer
Private Sub
Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
MyBase.Load
NUDedad.Minimum = 16
NUDedad.Maximum = 60
cbocolegio.Items.Add("Nacional")
cbocolegio.Items.Add("Parroquial")
cbocolegio.Items.Add("Particular")
cboespecialidad.Items.Add("Informatica")
cboespecialidad.Items.Add("Electronica")
cboespecialidad.Items.Add("Contabilidad")
txtcuota.Text = 1
txtseccion.MaxLength = 1
End Sub
Function SoloLETRAS(ByVal KeyAscii As Integer) As Integer
KeyAscii = Asc(UCase(Chr(KeyAscii))) 'Transformar
letras minusculas a Mayúsculas Intercepta un código ASCII recibido admitiendo
solamente letras, además: deja pasar sin afectar si recibe tecla de Backspace o
enter
If InStr("ABCD",
Chr(KeyAscii)) = 0 Then
SoloLETRAS = 0
Else
SoloLETRAS = KeyAscii
End If ' teclas adicionales permitidas
If KeyAscii = 8 Then
SoloLETRAS = KeyAscii ' Backspace
If KeyAscii = 13 Then SoloLETRAS = KeyAscii ' Enter
End Function
Private Sub Timer1_Tick(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
Timer1.Tick
If rbtfem.Checked = True Then
sexo = "F"
ElseIf rbtmas.Checked = True Then
sexo = "M"
End If
txtcodigo.Text = Microsoft.VisualBasic.Left(UCase(cboespecialidad.SelectedItem),
3) + sexo + NUDedad.Value.ToString + numero.ToString
End Sub
Private Sub
cbocolegio_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
cbocolegio.SelectedIndexChanged
Select Case
cbocolegio.SelectedIndex
Case
0
txtpensionbase.Text = 160
Case
1
txtpensionbase.Text = 185
Case
2
txtpensionbase.Text = 220
End Select
End Sub
Private Sub
cboespecialidad_SelectedIndexChanged(ByVal
sender As System.Object,
ByVal e As
System.EventArgs) Handles
cboespecialidad.SelectedIndexChanged
Select Case
cboespecialidad.SelectedIndex
Case
0
especialidad = 80
Case
1
especialidad = 60
Case
2
especialidad = 50
End Select
End Sub
Private Sub
HSBcuotas_Scroll(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.ScrollEventArgs) Handles HSBcuotas.Scroll
txtcuota.Text = HSBcuotas.Value
End Sub
Private Sub
txtseccion_KeyPress(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.KeyPressEventArgs) Handles txtseccion.KeyPress
Dim KeyAscii As
Short = CShort(Asc(e.KeyChar))
KeyAscii = CShort(SoloLETRAS(KeyAscii))
If KeyAscii = 0 Then
e.Handled = True
End If
End Sub
Private Sub
btninscribir_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
btninscribir.Click
txttotal.Text = (Val(txtpensionbase.Text) + especialidad) /
Val(txtcuota.Text)
End Sub
End Class
oye amigo no tienes el archivo sobre este reto 6
ResponderEliminar