Вы находитесь на странице: 1из 80

UNIVERSIDAD NACIONAL DE ANCASH

SANTIAGO ANTUNEZ DE MAYOLO


FACULTAD DE INGENIERIA DE MINAS
GEOLOGIA Y METALURGIA
Escuela Profesional de Ingeniera De Minas

TRABAJO: CODIGO DE PROGRAMAS

CURSO: LENGUAJE DE PROGRAMACION


ALUMNO:
HUAYANEY MILLA MIGUEL
DOCENTE:
Ing. Mag. SALAZAR CACERES ROLANDO

2011

CODIGO DE PROGRAMAS
PREGUNTA1(LLAMADAS TELEFONICAS):

Private Sub Command1_Click()


R = UCase(Text1)
If R = "MAHM92" Then
Command2.Enabled = True
Command3.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Option1.Enabled = True
Option2.Enabled = True
Text2.SetFocus
Else
MsgBox "No es valido el codigo", 16, "Error"

Text1 = ""
Text1.SetFocus
End If
End Sub
Private Sub Command2_Click()
Dim nll, nln, nli As Integer
nll = Val(Text3)
nln = Val(Text4)
nli = Val(Text5)
Form2.Show
If Option1.Value = True Then
If nll <= 15 Then
Form2.Text2 = Form1.Text3
Form2.Text1 = "DOMICILIARIO"
Form2.Text4 = 58 / 3
Else
Form2.Text2 = Form1.Text3
Form2.Text1 = "DOMICILIARIO"
Form2.Text4 = (126 / 100 * 58)
End If
If nln <= 8 Then
Form2.Text5 = Form1.Text4
Form2.Text1 = "DOMICILIARIO"
Form2.Text7 = 58 / 3
Else
Form2.Text5 = Form1.Text4

Form2.Text1 = "DOMICILIARIO"
Form2.Text7 = (131 / 100 * 58)
End If
If nli <= 5 Then
Form2.Text6 = Form1.Text5
Form2.Text1 = "DOMICILIARIO"
Form2.Text8 = 58 / 3
Else
Form2.Text6 = Form1.Text5
Form2.Text1 = "DOMICILIARIO"
Form2.Text8 = (136 / 100 * 58) + 58
End If
ElseIf Option2.Value = True Then
If nll <= 18 Then
Form2.Text2 = Form1.Text3
Form2.Text1 = "COMERCIAL"
Form2.Text4 = 75 / 3
Else
Form2.Text2 = Form1.Text3
Form2.Text1 = "COMERCIAL"
Form2.Text4 = (129 / 100 * 75)
End If
If nln <= 9 Then
Form2.Text5 = Form1.Text4
Form2.Text1 = "COMERCIAL"
Form2.Text7 = 75 / 3

Else
Form2.Text5 = Form1.Text4
Form2.Text1 = "COMERCIAL"
Form2.Text7 = (135 / 100 * 75)
End If
If nli <= 2 Then
Form2.Text6 = Form1.Text5
Form2.Text1 = "COMERCIAL"
Form2.Text8 = 75 / 3
Else
Form2.Text6 = Form1.Text5
Form2.Text1 = "COMERCIAL"
Form2.Text8 = (140 / 100 * 75)
End If
End If
Form2.Text3 = Val(Form2.Text4) + Val(Form2.Text7) + Val(Form2.Text8)
End Sub
Private Sub Command3_Click()
R = MsgBox("Ud. desea salir de la aplicacion", 36, "Cuidado")
If R = 6 Then
End
Else
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""

Text5 = ""
Option1.Value = False
Option2.Value = False
Command1.Enabled = False
Text1.SetFocus
End If
End Sub
Private Sub Form_Load()
Command1.Enabled = False
Command2.Enabled = False
Command3.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Option1.Value = False
Option2.Value = False
Option1.Enabled = False
Option2.Enabled = False
End Sub
Private Sub Text1_Change()
Text1.PasswordChar = "#"
Text1.MaxLength = 6
If Trim(Text1) <> "" Then
Command1.Enabled = True
End If
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)


If (KeyAscii >= 97 And KeyAscii <= 122) Or (KeyAscii >= 65 And KeyAscii <= 90) Or
KeyAscii = 8 Or KeyAscii = 32 Then
Else
MsgBox "Solo letras", 16, "ERROR"
KeyAscii = 0
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Then
Else
MsgBox "solo numeros", 16, "ERROR"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Then
Else
MsgBox "solo numeros", 16, "ERROR"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text5.SetFocus

End If
End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Then
Else
MsgBox "solo numeros", 16, "ERROR"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Command2.SetFocus
End If
End Sub

Private Sub Command1_Click()


Text1 = ""
Text2 = ""
Text3 = ""

Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Form1.Text1 = ""
Form1.Text2 = ""
Form1.Text3 = ""
Form1.Text4 = ""
Form1.Text5 = ""
Form1.Command1.Enabled = False
Form1.Command2.Enabled = False
Form1.Command3.Enabled = False
Form1.Text2.Enabled = False
Form1.Text3.Enabled = False
Form1.Text4.Enabled = False
Form1.Text5.Enabled = False
Form1.Option1.Value = False
Form1.Option2.Value = False
Form1.Option1.Enabled = False
Form1.Option2.Enabled = False
Form1.Text1.SetFocus
Form1.Show
End Sub

PREGUNTA2 (DIAS DE LA SEMANA):

Dim fc As Date
Private Sub Command1_Click()
Dim dia As String
fc = CVDate(Text1)
dia = Weekday(fc)
Select Case dia
Case 1
Label4.Caption = "Domingo"
Case 2
Label4.Caption = "Lunes"
Case 3
Label4.Caption = "Martes"
Case 4

Label4.Caption = "Miercoles"
Case 5
Label4.Caption = "Jueves"
Case 6
Label4.Caption = "Viernes"
Case 7
Label4.Caption = "Sabado"
End Select
End Sub
Private Sub Command2_Click()
Text1 = ""
Label4 = ""
Text1.SetFocus
End Sub
Private Sub Command3_Click()
R = MsgBox("Ud. desea salir", 36, "Cuidado")
If R = 6 Then
End
Else
Text1 = ""
Label4 = ""
End If
End Sub
Private Sub Form_Load()
Command1.Enabled = False
End Sub

Private Sub Text1_Change()


If Trim(Text1) <> "" Then
Command1.Enabled = True
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 47 Or KeyAscii = 13
Then
Else
MsgBox "Solo nemuros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub
Private Sub Text1_LostFocus()
If Not IsDate(Text1) Then
MsgBox "Ingrese texto como formato fecha(dd-mm-yyyy)", 64, "Advertencia"
Text1 = ""
Text1.SetFocus
End If
End Sub

PREGUNTA3 (SUELDO DE n TRABAJADORES):

Dim sd As Single
Dim nt As Integer
Private Sub Command1_Click()
sd = Val(Text1)
nt = Val(Text2)
sdu = sd / nt
Label9.Caption = sdu
Select Case sdu
Case Is < 1270
Label4.Caption = 9 / 100

Label6.Caption = 0
Label11.Caption = 109 / 100 * sdu
Case Is = 1270
MsgBox "Cada trabajador tiene derecho a 1 dia de liecncia", 64, "Licencia"
Case Is > 1270
Label4.Caption = 0
Label6.Caption = 5 / 100
Label11.Caption = 95 / 100 * sdu
End Select
If Val(Text2) > Val(Text1) Then
MsgBox "El sueldo sea mayor que el numero de trabajadores", 16, "cuidado"
Text1 = ""
Text2 = ""
Text1.SetFocus
End If
End Sub
Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Label11.Caption = ""
Label9.Caption = ""
Label4.Caption = ""
Label6.Caption = ""
Text1.SetFocus
End Sub
Private Sub Command3_Click()

R = MsgBox("Ud. desea salir de esta aplicacion", 36, "Salir")


If R = 6 Then
End
Else
Text1 = ""
Text2 = ""
Label11.Caption = ""
Label9.Caption = ""
Label4.Caption = ""
Label6.Caption = ""
Text1.SetFocus
End If
End Sub
Private Sub Form_Load()
Command1.Enabled = False
End Sub
Private Sub Text1_Change()
If Trim(Text1) <> "" Then
Command1.Enabled = True
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Then
Else
MsgBox "Solo numeros y positivos", 16, "Error"
KeyAscii = 0

End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Then
Else
MsgBox "Solo numeros y positivos", 16, "Error"
KeyAscii = 0
End If
End Sub
PREGUNTA4 (TEABULACION DE UNA FUNCION):

Private Sub Command1_Click()


Dim x As Integer
x = Val(Text1)

If x = 0 Or x = 1 Then
MsgBox "El numero da un valor imaginario", 16, "Error"
Text1 = ""
Text1.SetFocus
End If
If x = 2 Then
MsgBox "El numero da un valor indeterminado", 16, "Error"
Text1 = ""
Text1.SetFocus
End If
If x >= 3 And x < 26 Then
a = 3 * x ^ 3 - 10
d=2*x-4
n = a ^ 0.5 / d
Text2 = Format(n, "###.##")
End If
End Sub
Private Sub Command2_Click()
R = MsgBox("Ud. desea salir de la aplicaion", 36, "Cuidado")
If R = 6 Then
End
Else
Text1 = ""
Text2 = ""
Text1.SetFocus
End If

End Sub
Private Sub Command3_Click()
Text1 = ""
Text2 = ""
Text1.SetFocus
End Sub
Private Sub Form_Load()
Command1.Enabled = False
End Sub
Private Sub Text1_Change()
If Trim(Text1) <> "" Then
Command1.Enabled = True
End If
If Val(Text1) < 0 Or Val(Text1) >= 26 Then
MsgBox "Solo numeros de 0 a 25", 16, "Error"
Text1 = ""
Text1.SetFocus
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Then
Else
MsgBox "Solo numeros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then

Command1.SetFocus
End If
End Sub
PREGUNTA5 (CALCULO DEL PROMEDIO FINAL):

Dim p1, p2, p3, p4, p5, ep, ef As Integer


Private Sub Command1_Click()
p1 = Val(Text1)
p2 = Val(Text2)
p3 = Val(Text3)
p4 = Val(Text4)
p5 = Val(Text5)
ep = Val(Text6)
ef = Val(Text7)

pp = (p1 + p2 + p3 + p4 + p5) / 5
Text10 = pp
pf = (ep + ef + pp) / 3
Text8 = pf
If Option1.Value = True Then
Text8 = pf + 2
If Text8 <= 10.4 Then
Text9 = "DESAPROBADO"
Else
Text9 = "APROBADO"
End If
ElseIf Option2.Value = True Then
Text8 = pf - 1
If Text8 <= 10.4 Then
Text9 = "DESAPROBADO"
Else
Text9 = "APROBADO"
End If
End If
If pf > 18.5 Then
If Option1.Value = True Then
Text8 = 20
ElseIf Option2.Value = True Then
Text8 = pf - 1
End If
End If

If pf = 20 Then
If Option1.Value = True Then
Text8 = 20
ElseIf Option2.Value = True Then
Text8 = pf - 1
End If
End If
If pp <= 8 Then
MsgBox "Ud. no tiene derecho a su examen final", 64, "Desaprobado"
Text7 = 0
Text8 = 0
Text9 = "DESAPROBADO"
Option1.Enabled = False
Option2.Enabled = False
End If
End Sub
Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Text9 = ""

Text10 = ""
Option1.Value = False
Option2.Value = False
Option1.Enabled = True
Option2.Enabled = True
Text1.SetFocus
End Sub
Private Sub Command3_Click()
R = MsgBox("Ud. desea salir de esta aplicacion", 36, "Salir")
If R = 6 Then
End
Else
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Text9 = ""
Text10 = ""
Option1.Value = False
Option2.Value = False
Text1.SetFocus
End If

End Sub
Private Sub Form_Load()
Command1.Enabled = False
Option1.Enabled = True
Option2.Enabled = True
Option1.Value = False
Option2.Value = False
End Sub
Private Sub Text1_Change()
If Trim(Text1) <> "" Then
Command1.Enabled = True
End If
If Val(Text1) < 0 Or Val(Text1) > 20 Then
MsgBox "Solo notas de 0 a 20", 16, "Error"
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
Text1 = Text1.SelText
Text1.SetFocus
Else
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Then
Else
MsgBox "Solo se admite numeros", 16, "Error"
KeyAscii = 0

Text1.SetFocus
End If
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_Change()
If Val(Text2) < 0 Or Val(Text2) > 20 Then
MsgBox "Solo notas de 0 a 20", 16, "Error"
Text2.SelStart = 0
Text2.SelLength = Len(Text2)
Text2 = Text2.SelText
Text2.SetFocus
Else
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Then
Else
MsgBox "Solo se admite numeros", 16, "Error"
KeyAscii = 0
Text2.SetFocus
End If
If KeyAscii = 13 Then
Text3.SetFocus
End If

End Sub
Private Sub Text3_Change()
If Val(Text3) < 0 Or Val(Text3) > 20 Then
MsgBox "Solo notas de 0 a 20", 16, "Error"
Text3.SelStart = 0
Text3.SelLength = Len(Text3)
Text3 = Text3.SelText
Text3.SetFocus
Else
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Then
Else
MsgBox "Solo se admite numeros", 16, "Error"
KeyAscii = 0
Text3.SetFocus
End If
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub
Private Sub Text4_Change()
If Val(Text4) < 0 Or Val(Text4) > 20 Then
MsgBox "Solo notas de 0 a 20", 16, "Error"
Text4.SelStart = 0

Text4.SelLength = Len(Text4)
Text4 = Text4.SelText
Text4.SetFocus
Else
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Then
Else
MsgBox "Solo se admite numeros", 16, "Error"
KeyAscii = 0
Text4.SetFocus
End If
If KeyAscii = 13 Then
Text5.SetFocus
End If
End Sub
Private Sub Text5_Change()
If Val(Text5) < 0 Or Val(Text5) > 20 Then
MsgBox "Solo notas de 0 a 20", 16, "Error"
Text5.SelStart = 0
Text5.SelLength = Len(Text5)
Text5 = Text5.SelText
Text5.SetFocus
Else
End If

End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Then
Else
MsgBox "Solo se admite numeros", 16, "Error"
KeyAscii = 0
Text5.SetFocus
End If
If KeyAscii = 13 Then
Text6.SetFocus
End If
End Sub
Private Sub Text6_Change()
If Val(Text6) < 0 Or Val(Text6) > 20 Then
MsgBox "Solo notas de 0 a 20", 16, "Error"
Text6.SelStart = 0
Text6.SelLength = Len(Text6)
Text6 = Text6.SelText
Text6.SetFocus
Else
End If
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Then
Else
MsgBox "Solo se admite numeros", 16, "Error"

KeyAscii = 0
Text6.SetFocus
End If
If KeyAscii = 13 Then
Text7.SetFocus
End If
End Sub
Private Sub Text7_Change()
If Val(Text7) < 0 Or Val(Text7) > 20 Then
MsgBox "Solo notas de 0 a 20", 16, "Error"
Text7.SelStart = 0
Text7.SelLength = Len(Text7)
Text7 = Text7.SelText
Text7.SetFocus
Else
End If
End Sub
Private Sub Text7_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Then
Else
MsgBox "Solo se admite numeros", 16, "Error"
KeyAscii = 0
Text7.SetFocus
End If
End Sub

PREGUNTA6:

Dim vd, a, vu As Single


Private Sub Command1_Click()
vd = Val(Text5)
a = Val(Text2)
vu = Val(Text3)
If Option1.Value = True Then
cd = vd / vu
Text4 = cd
End If
If Option2.Value = True Then
fm = a / (vu * (vu + 1) / 2)
cd = fm * vd
Text4 = cd
If a < vu Then
Else
MsgBox "Los aos no puede exceder a la vida util", 16, "Error"

Text2 = ""
Text3 = ""
Text4 = ""
Option1.Value = False
Option2.Value = False
Option3.Value = False
Text2.SetFocus
End If
End If
If Option3.Value = True Then
cd = (vd / vu) * 2 * a
Text4 = cd
If a <= vu Then
Else
MsgBox "Los aos no puede exceder a la vida util", 16, "Error"
Text2 = ""
Text3 = ""
Text4 = ""
Option1.Value = False
Option2.Value = False
Option3.Value = False
Text2.SetFocus
End If
End If
End Sub
Private Sub Command2_Click()

Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Option1.Value = False
Option2.Value = False
Option3.Value = False
Text1.SetFocus
End Sub

Private Sub Command3_Click()


R = MsgBox("Ud. desea salir de esta aplicaion", 36, "Cuidado")
If R = 6 Then
End
Else
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Option1.Value = False
Option2.Value = False
Option3.Value = False
Text1.SetFocus
End If

End Sub
Private Sub Form_Load()
Command1.Enabled = False
Option1.Value = False
Option2.Value = False
Option3.Value = False
End Sub
Private Sub Text1_Change()
If Trim(Text1) <> "" Then
Command1.Enabled = True
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or
KeyAscii = 8 Or KeyAscii = 13 Then
Else
MsgBox "Solo letras", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text5.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 13 Or KeyAscii = 8 Then
Else

MsgBox "Solo numeros", 16, "Error"


KeyAscii = 0
End If
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 13 Or KeyAscii = 8 Then
Else
MsgBox "Solo numeros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub

Private Sub Text5_KeyPress(KeyAscii As Integer)


If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 13 Or KeyAscii = 8 Then
Else
MsgBox "Solo numeros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text2.SetFocus

End If
End Sub
PREGUNTA7:

Private Sub Command1_Click()


MsgBox "Ud. sea bienvenido", 64, "Bienbenido"
Label1.Visible = True
Command2.Enabled = True
Command2.SetFocus
End Sub
Private Sub Command2_Click()
Dim ct As String
ct = Text2
Form2.Show
Select Case ct
Case Is = "S"
Form2.Label9 = Form1.Text1

Form2.Label10 = "Superintendente"
Form2.Label11 = 7010
Form2.Label12 = -0.1 * 7010
Form2.Label13 = -0.05 * 7010
Form2.Label14 = -0.05 * 7010
Form2.Label15 = 0.8 * 7010
Case Is = "I"
Form2.Label9 = Form1.Text1
Form2.Label10 = "Ingeniero"
Form2.Label11 = 4127
Form2.Label12 = -0.1 * 4127
Form2.Label13 = -0.05 * 4127
Form2.Label14 = -0.05 * 4127
Form2.Label15 = 0.8 * 4127
Case Is = "O"
Form2.Label9 = Form1.Text1
Form2.Label10 = "Operario"
Form2.Label11 = 2419
Form2.Label12 = -0.1 * 2419
Form2.Label13 = -0.05 * 2419
Form2.Label14 = -0.05 * 2419
Form2.Label15 = 0.8 * 2419
End Select
End Sub
Private Sub Command3_Click()
R = MsgBox("Ud desea salir de esta aplicacion", 36, "Cuidado")

If R = 6 Then
End
Else
Text1 = ""
Text2 = ""
Label1.Visible = False
Text1.SetFocus
End If
End Sub
Private Sub Form_Load()
Label1.Visible = False
Command1.Enabled = False
Command2.Enabled = False
End Sub
Private Sub Text1_Change()
If Trim(Text1) <> "" Then
Command1.Enabled = True
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 97 And KeyAscii <= 122) Or (KeyAscii >= 65 And KeyAscii <= 90) Or
KeyAscii = 13 Or KeyAscii = 8 Or KeyAscii = 32 Then
Else
MsgBox "Ingrese solo letras", 16, "Error"
KeyAscii = 0
End If

If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
Dim letra As String * 1
If KeyAscii = 13 Then
Command1.SetFocus
Else
letra = UCase(Chr(KeyAscii))
If letra = "S" Or letra = "I" Or letra = "O" Or KeyAscii = 8 Then
KeyAscii = Asc(letra)
Else
MsgBox "Debe ingresar solo letras S, I, O", 16, "ERROR"
KeyAscii = 0
End If
End If
End Sub

Private Sub Command1_Click()


Label9 = ""
Label10 = ""
Label11 = ""
Label12 = ""
Label13 = ""
Label14 = ""
Label15 = ""
Form1.Show
Form1.Label1.Visible = False
Form1.Text1 = ""
Form1.Text2 = ""
Form1.Command1.Enabled = False

Form1.Command2.Enabled = False
Form1.Text1.SetFocus
End Sub
Private Sub Command2_Click()
R = MsgBox("Ud desea salir de esta aplicacion", 36, "Cuidado")
If R = 6 Then
End
Else
Label9 = ""
Label10 = ""
Label11 = ""
Label12 = ""
Label13 = ""
Label14 = ""
Label15 = ""
Form1.Show
Form1.Label1.Visible = False
Form1.Text1 = ""
Form1.Text2 = ""
Form1.Command1.Enabled = False
Form1.Command2.Enabled = False
Form1.Text1.SetFocus
End If
End Sub

PREGUNTA8:

Private Sub Command1_Click()


If Option1.Value = True Then
List1.AddItem "Quimica Analitica"
List1.AddItem "Lenguaje de Programacion"
List1.AddItem "Estatica"
List1.AddItem "Diseo y metodos de explotacion"
List1.AddItem "Geologia Estructural"
List1.AddItem "Estadistica"
End If
If Option2.Value = True Then
List1.AddItem "Quimica Organica"
List1.AddItem "Procesamiento de aguas"

List1.AddItem "Medio Ambiente"


List1.AddItem "Matematica"
List1.AddItem "Microbiologia"
List1.AddItem "Gestion Ambiental"
End If
If Option3.Value = True Then
List1.AddItem "Codigo Civiles"
List1.AddItem "Liderazgo"
List1.AddItem "Psicologia"
List1.AddItem "Axiologia"
List1.AddItem "Derechos Humanos"
List1.AddItem "Comunicacion"
End If
If Option4.Value = True Then
List1.AddItem "Medicina"
List1.AddItem "Biologia"
List1.AddItem "Quimica General"
List1.AddItem "Farmacologia"
List1.AddItem "Fisicoquimica"
List1.AddItem "Patologia"
End If
End Sub
Private Sub Command2_Click()
List2.AddItem List1
End Sub
Private Sub Command3_Click()

List2.RemoveItem (List2.ListIndex)
End Sub
Private Sub Command4_Click()
List1.Clear
List2.Clear
Text1 = ""
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
Text1.SetFocus
End Sub
Private Sub Command5_Click()
R = MsgBox("Ud desea salir de esta aplicacion", 36, "Cuidado")
If R = 6 Then
End
Else
List1.Clear
List2.Clear
Text1 = ""
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
Text1.SetFocus
End If

End Sub
Private Sub Form_Load()
Command1.Enabled = False
End Sub
Private Sub Text1_Change()
If Trim(Text1) <> "" Then
Command1.Enabled = True
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or
KeyAscii = 8 Or KeyAscii = 32 Then
Else
MsgBox "Solo letras", 16, "Error"
KeyAscii = 0
End If
End Sub

PREGUNTA9:

Private Sub Command1_Click()


Dim nb As Integer
nb = Val(Text4)
Form2.Show
If Combo1.Text = "CHIMBOTE" Then
Form2.Label3 = Form1.Text1
Form2.Label5 = "CHIMBOTE"
Form2.Label7 = Form1.Text2
Form2.Label9 = Form1.Text3
Form2.Label11 = 45
If nb >= 2 Then
Form2.Label13 = 45 * 0.12
Form2.Label15 = 45 * 88 / 100 * nb
Else

Form2.Label13 = 0
Form2.Label15 = 45
End If
End If
If Combo1.Text = "TRUJILLO" Then
Form2.Label3 = Form1.Text1
Form2.Label5 = "TRUJILLO"
Form2.Label7 = Form1.Text2
Form2.Label9 = Form1.Text3
Form2.Label11 = 66
If nb >= 2 Then
Form2.Label13 = 66 * 0.12
Form2.Label15 = 66 * 88 / 100 * nb
Else
Form2.Label13 = 0
Form2.Label15 = 66
End If
End If
If Combo1.Text = "CHICLAYO" Then
Form2.Label3 = Form1.Text1
Form2.Label5 = "CHICLAYO"
Form2.Label7 = Form1.Text2
Form2.Label9 = Form1.Text3
Form2.Label11 = 71
If nb >= 2 Then
Form2.Label13 = 71 * 0.12

Form2.Label15 = 71 * 88 / 100 * nb
Else
Form2.Label13 = 0
Form2.Label15 = 71
End If
End If
If Combo1.Text = "CAJAMARCA" Then
Form2.Label3 = Form1.Text1
Form2.Label5 = "CAJAMARCA"
Form2.Label7 = Form1.Text2
Form2.Label9 = Form1.Text3
Form2.Label11 = 85
If nb >= 2 Then
Form2.Label13 = 85 * 0.12
Form2.Label15 = 85 * 88 / 100 * nb
Else
Form2.Label13 = 0
Form2.Label15 = 85
End If
End If
If Combo1.Text = "PIURA" Then
Form2.Label3 = Form1.Text1
Form2.Label5 = "PIURA"
Form2.Label7 = Form1.Text2
Form2.Label9 = Form1.Text3
Form2.Label11 = 93

If nb >= 2 Then
Form2.Label13 = 93 * 0.12
Form2.Label15 = 93 * 88 / 100 * nb
Else
Form2.Label13 = 0
Form2.Label15 = 93
End If
End If
If Combo1.Text = "TUMBES" Then
Form2.Label3 = Form1.Text1
Form2.Label5 = "TUMBES"
Form2.Label7 = Form1.Text2
Form2.Label9 = Form1.Text3
Form2.Label11 = 118
If nb >= 2 Then
Form2.Label13 = 118 * 0.12
Form2.Label15 = 118 * 88 / 100 * nb
Else
Form2.Label13 = 0
Form2.Label15 = 118
End If
End If
End Sub
Private Sub Command2_Click()
R = MsgBox("Ud. desea salir de esta aplicacion", 36, "Cuidado")
If R = 6 Then

End
Else
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Combo1.Text = ""
End If
End Sub
Private Sub Text1_Change()
If Trim(Text1) <> "" Then
Command1.Enabled = True
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or
KeyAscii = 8 Or KeyAscii = 32 Then
Else
MsgBox "Solo se admite letras", 16, "Error"
KeyAscii = 0
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 47 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Then
Else
MsgBox "Solo se debe de ingresar numeros", 16, "Error"

KeyAscii = 0
End If
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub Text2_LostFocus()
If Not IsDate(Text2) Then
MsgBox "Ingrese texto con formato fecha (dd/mm/aa)", 64, "Advertencia"
Text2 = ""
Text2.SetFocus
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 65 Or KeyAscii = 77 Or KeyAscii = 80
Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 58 Then
Else
MsgBox "Solo numeros y letras de la forma hh:mm AM/PM", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 49 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Then

Else
MsgBox "Solo se debe de ingresar numeros pero menos el 0", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub

Private Sub Command1_Click()


Label3 = ""
Label5 = ""
Label7 = ""
Label9 = ""
Label11 = ""

Label13 = ""
Label15 = ""
Form1.Text1 = ""
Form1.Text2 = ""
Form1.Text3 = ""
Form1.Text4 = ""
Form1.Combo1.Text = ""
Form1.Show
Form1.Text1.SetFocus
End Sub
PREGUNTA10:

Private Sub Command1_Click()


Dim fc As Date
fc = CVDate(Text2)
Form2.Show
If Option1.Value = True Then
Form2.Label3 = Form1.Text1
Form2.Label5 = "Gerente"

Form2.Label7 = (Year(Date) - Year(fc))


Form2.Label9 = 3570
If Val(Form2.Label7) > 10 Then
Form2.Label11 = 520
Form2.Label13 = 3570 + 520
Else
Form2.Label11 = 0
Form2.Label13 = 3570
End If
End If
If Option2.Value = True Then
Form2.Label3 = Form1.Text1
Form2.Label5 = "Subgerente"
Form2.Label7 = (Year(Date) - Year(fc))
Form2.Label9 = 2160
If Val(Form2.Label7) > 8 Then
Form2.Label11 = 310
Form2.Label13 = 2160 + 310
Else
Form2.Label11 = 0
Form2.Label13 = 2160
End If
End If
If Option3.Value = True Then
Form2.Label3 = Form1.Text1
Form2.Label5 = "Secretaria"

Form2.Label7 = (Year(Date) - Year(fc))


Form2.Label9 = 1530
If Val(Form2.Label7) > 5 Then
Form2.Label11 = 205
Form2.Label13 = 1530 + 205
Else
Form2.Label11 = 0
Form2.Label13 = 1530
End If
End If
End Sub

Private Sub Command2_Click()


R = masgbox("Ud. desea salir de esta aplicacion", 36, "Cuidado")
If R = 6 Then
End
Else
Text1 = ""
Text2 = ""
Option1.Value = False
Option2.Value = False
Option3.Value = False
Text1.SetFocus
End If
End Sub

Private Sub Form_Load()


Command1.Enabled = False
Option1.Value = False
Option2.Value = False
Option3.Value = False
End Sub
Private Sub Text1_Change()
If Trim(Text1) <> "" Then
Command1.Enabled = True
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 65 And KeyAscii <= 90) Or (KeyAscii >= 97 And KeyAscii <= 122) Or
KeyAscii = 32 Or KeyAscii = 8 Or KeyAscii = 13 Then
Else
MsgBox "Solo letras", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 47 And KeyAscii <= 57) Or KeyAscii = 8 Then
Else
MsgBox "Solo numeros para fecha", 16, "Error"

KeyAscii = 0
End If
End Sub
Private Sub Text2_LostFocus()
If Not IsDate(Text2) Then
MsgBox "Solo numeros de tipo fecha dd/mm/aa", 64, "Advertencia"
Text2 = ""
Text2.SetFocus
End If
End Sub

Private Sub Command1_Click()


Label3 = ""
Label5 = ""
Label7 = ""
Label9 = ""
Label11 = ""

Label13 = ""
Form1.Text1 = ""
Form1.Text2 = ""
Form1.Option1.Value = False
Form1.Option2.Value = False
Form1.Option3.Value = False
Form1.Text1.SetFocus
End Sub
PREGUNTA11: (ELECCION DE UN METODO DE EXPLOTACION)

Private Sub Command1_Click()


Dim pt, bu, ta As Single
pt = Val(Text1)
bu = Val(Text2)
ta = Val(Text3)
If pt >= 3 And bu <= 30 And Option1.Value = True Then
Label5 = "ROOM AND PILLAR (CAMARAS Y PILARES)"
Label7 = "Natural"
Label10 = ">500 k/cm2"
Label12 = ">500 k/cm2"
Label14 = "Muy baja"
Label16 = "<600 m"
Label18 = "Elastico"
Label21 = "Bajo"
Label23 = "Alto"
Picture1.Visible = True
ElseIf pt >= 10 And bu > 30 And ta >= 10 And Option3.Value = True Then
Label5 = "SUBLEVEL STOPING(METODO POR SUBNIVELES)"
Label7 = "Natural"
Label10 = ">500 k/cm2"
Label12 = "Incluye poco"
Label14 = "Baja"
Label16 = "<1000 m"
Label18 = "Elastico"
Label21 = "Bajo"
Label23 = "Alto"

Picture2.Visible = True
ElseIf pt >= 3 And bu >= 60 And ta >= 15 And Option2.Value = True Then
Label5 = "SHRINKAGE"
Label7 = "Artificial"
Label10 = ">50 MPa"
Label12 = ">50 MPa"
Label14 = "Media-baja"
Label16 = "<1000 m"
Label18 = "Elastico"
Label21 = "Alto"
Label23 = "Media-baja"
Picture3.Visible = True
ElseIf pt >= 3 And bu >= 60 And ta >= 4 And Option2.Value = True Then
Label5 = "CUT AND FILL(CORTE Y RELLENO)"
Label7 = "Artificial"
Label10 = ">50 MPa"
Label12 = ">50 MPa"
Label14 = "Media-baja"
Label16 = "<1000 m"
Label18 = "Elastico"
Label21 = "Alto"
Label23 = "Media-baja"
Picture4.Visible = True
ElseIf pt >= 50 And bu = 90 And ta >= 50 And Option4.Value = True Then
Label5 = "BLOCK CAVING(HUNDIMIENTO POR BLOQUES)"
Label7 = "Hundimiento"

Label10 = ">500 k/cm2"


Label12 = ">500 k/cm2"
Label14 = "Muy baja"
Label16 = "<600 m"
Label18 = "Elastico"
Label21 = "Bajo"
Label23 = "Alto"
Picture5.Visible = True
ElseIf pt >= 20 And bu = 90 And ta >= 30 And Option4.Value = True Then
Label5 = "SUBLEVEL CAVING(HUNDIMIENTO POR SUBNIVELES)"
Label7 = "Hundimiento"
Label10 = ">500 k/cm2"
Label12 = ">500 k/cm2"
Label14 = "Muy baja"
Label16 = "<600 m"
Label18 = "Elastico"
Label21 = "Bajo"
Label23 = "Alto"
Picture6.Visible = True
End If
End Sub
Private Sub Command2_Click()
Label5 = ""
Label7 = ""
Label10 = ""
Label12 = ""

Label14 = ""
Label16 = ""
Label18 = ""
Label21 = ""
Label23 = ""
Text1 = ""
Text2 = ""
Text3 = ""
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
Picture1.Visible = False
Picture2.Visible = False
Picture3.Visible = False
Picture4.Visible = False
Picture5.Visible = False
Picture6.Visible = False
Command1.Enabled = False
Text1.SetFocus
End Sub
Private Sub Command3_Click()
R = MsgBox("Ud. desea salir de esta aplicacion", 36, "Cuidado")
If R = 6 Then
End
Else

Text1 = ""
Text2 = ""
Text3 = ""
Label5 = ""
Label7 = ""
Label10 = ""
Label12 = ""
Label14 = ""
Label16 = ""
Label18 = ""
Label21 = ""
Label23 = ""
Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
Picture1.Visible = False
Picture2.Visible = False
Picture3.Visible = False
Picture4.Visible = False
Picture5.Visible = False
Picture6.Visible = False
Command1.Enabled = False
Text1.SetFocus
End If
End Sub

Private Sub Form_Load()


Option1.Value = False
Option2.Value = False
Option3.Value = False
Option4.Value = False
Picture1.Visible = False
Picture2.Visible = False
Picture3.Visible = False
Picture4.Visible = False
Picture5.Visible = False
Picture6.Visible = False
Command1.Enabled = False
End Sub
Private Sub Text1_Change()
If Trim(Text1) <> "" Then
Command1.Enabled = True
End If
If Val(Text1) < 0 Or Val(Text1) > 200 Then
MsgBox "Solo numeros de 0 a 200", 16, "Error"
Text1.SelStart = 0
Text1.SelLength = Len(Text1)
Text1 = Text1.SelText
Text1.SetFocus
Else
End If
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)


If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Then
Else
MsgBox "Solo numeros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_Change()
If Val(Text2) < 0 Or Val(Text2) > 90 Then
MsgBox "Solo numeros de 0 a 90", 16, "Error"
Text2.SelStart = 0
Text2.SelLength = Len(Text2)
Text2 = Text2.SelText
Text2.SetFocus
Else
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Then
Else
MsgBox "Solo numeros", 16, "Error"
KeyAscii = 0
End If

If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub Text3_Change()
If Val(Text3) < 0 Or Val(Text3) > 200 Then
MsgBox "Solo numeros de 0 a 200", 16, "Error"
Text3.SelStart = 0
Text3.SelLength = Len(Text3)
Text3 = Text3.SelText
Text3.SetFocus
Else
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Then
Else
MsgBox "Solo numeros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub

PREGUNTA12:

Private Sub Command1_Click()


Dim re, pp, de, tc, vc, cp, pud As Single
re = Val(Text1)
pp = Val(Text2)
de = Val(Text3)
tc = Val(Text4)
vc = Val(Text5)
cp = Val(Text6)
pud = Val(Text7)
If de <> 0 Then
If re <> de And re <> 0 Then
If pp <> 0 Then
If pud <> 0 Then

rc = re / de * 1000
pd = pp / rc * 1000
ppd = pd * pud / 1000
cd = ppd / pp
vm = vc * tc / pp
cdmax = vm - cp + cd
ppdmax = cdmax * pp / 1000
pdmax = ppdmax / pud * 1000000
Label9 = rc & " T/m"
Label11 = pd & " m/a"
Label13 = ppd & " K$/a"
Label15 = cd & " $/T"
Label17 = vm & " $/T"
Label20 = pdmax & " m/a"
Label21 = ppdmax & " M$/a"
Label22 = cdmax & " $/T"
Else
MsgBox "El precio unitario no puede ser 0", 16, "Error"
Text7 = ""
Text7.SetFocus
End If
Else
MsgBox "El prog. de prod. no puede ser 0", 16, "Error"
Text2 = ""
Text2.SetFocus
End If

Else
MsgBox "El valor de res. y des. no pueden ser iguales ni re.= 0", 16, "Error"
Text1 = ""
Text3 = ""
Text1.SetFocus
End If
Else
MsgBox "El valor de desarrollos no puede ser 0", 16, "Error"
Text3 = ""
Text3.SetFocus
End If
End Sub
Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Label9 = ""
Label11 = ""
Label13 = ""
Label15 = ""
Label17 = ""
Label20 = ""

Label21 = ""
Label22 = ""
Command1.Enabled = False
Text1.SetFocus
End Sub
Private Sub Command3_Click()
R = MsgBox("Ud. desea salir de la aplicacion", 36, "Cuidado")
If R = 6 Then
End
Else
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Label9 = ""
Label11 = ""
Label13 = ""
Label15 = ""
Label17 = ""
Label20 = ""
Label21 = ""
Label22 = ""
Command1.Enabled = False

Text1.SetFocus
End If
End Sub
Private Sub Form_Load()
Command1.Enabled = False
End Sub
Private Sub Text1_Change()
If Trim(Text1) <> "" Then
Command1.Enabled = True
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 46
Then
Else
MsgBox "Solo numeros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 46
Then
Else
MsgBox "Solo numeros", 16, "Error"

KeyAscii = 0
End If
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 46
Then
Else
MsgBox "Solo numeros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 46
Then
Else
MsgBox "Solo numeros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text5.SetFocus
End If

End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 46
Then
Else
MsgBox "Solo numeros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text6.SetFocus
End If
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 46
Then
Else
MsgBox "Solo numeros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text7.SetFocus
End If
End Sub
Private Sub Text7_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 46
Then
Else

MsgBox "Solo numeros", 16, "Error"


KeyAscii = 0
End If
If KeyAscii = 13 Then
Command1.SetFocus
End If
End Sub
PREGUNTA13:

Private Sub Command1_Click()


Dim v1, v2, v3, g1d, g2d, g3d, g1c, g2c, g3c As Single
v1 = Val(Text1)
v2 = Val(Text2)
v3 = Val(Text3)
g1d = Val(Text4)

g2d = Val(Text5)
g3d = Val(Text6)
g1c = Val(Text7)
g2c = Val(Text8)
g3c = Val(Text9)
If g1d > g1c And g2d > g2c And g3d > g3c Then
vm = (v1 + v2 + v3) / 3
gdp = (g1d + g2d + g3d) / 3
gcp = (g1c + g2c + g3c) / 3
dt = gdp * 1000 / vm
dca = gcp * 1000 / vm
dmg = (gdp - gcp) * 1000 / vm
ct = 0.4 * gcp * 1000 / vm
mt = 0.243 * (gdp - gcp) * 1000 / vm
Label9 = 1 & " mgCaCO3/mlEDTA"
Label11 = dt & " mgCaCO3/L"
Label13 = dca & " mgCaCO3/L"
Label16 = dmg & " mgCaCO3/L"
Label18 = 0.4 & " mgCa/mlEDTA"
Label20 = 0.243 & " mgMg/mlEDTA"
Label22 = ct & " mgCa/L"
Label24 = mt & " mgMg/L"
Else
MsgBox "El valor de los gasto(DT)<gasto (DCa) o gasto(DT) = gasto (DCa)", 16, "Error"
Text4 = ""
Text5 = ""

Text6 = ""
Text7 = ""
Text8 = ""
Text9 = ""
Text4.SetFocus
End If
End Sub
Private Sub Command2_Click()
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Text9 = ""
Label9 = ""
Label11 = ""
Label13 = ""
Label16 = ""
Label18 = ""
Label20 = ""
Label22 = ""
Label24 = ""
Command1.Enabled = False

Text1.SetFocus
End Sub

Private Sub Command3_Click()


R = MsgBox("Ud. desea salir de esta aplicacion", 36, "Cuidado")
If R = 6 Then
End
Else
Text1 = ""
Text2 = ""
Text3 = ""
Text4 = ""
Text5 = ""
Text6 = ""
Text7 = ""
Text8 = ""
Text9 = ""
Label9 = ""
Label11 = ""
Label13 = ""
Label16 = ""
Label18 = ""
Label20 = ""
Label22 = ""
Label24 = ""
Command1.Enabled = False

Text1.SetFocus
End If
End Sub
Private Sub Form_Load()
Command1.Enabled = False
End Sub
Private Sub Text1_Change()
If Trim(Text1) <> "" Then
Command1.Enabled = True
End If
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 46
Then
Else
MsgBox "Debe de ingresar solo numeros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 46
Then
Else
MsgBox "Debe de ingresar solo numeros", 16, "Error"

KeyAscii = 0
End If
If KeyAscii = 13 Then
Text3.SetFocus
End If
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 46
Then
Else
MsgBox "Debe de ingresar solo numeros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text4.SetFocus
End If
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 46
Then
Else
MsgBox "Debe de ingresar solo numeros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text5.SetFocus
End If

End Sub
Private Sub Text5_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 46
Then
Else
MsgBox "Debe de ingresar solo numeros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text6.SetFocus
End If
End Sub
Private Sub Text6_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 46
Then
Else
MsgBox "Debe de ingresar solo numeros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text7.SetFocus
End If
End Sub
Private Sub Text7_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 46
Then
Else

MsgBox "Debe de ingresar solo numeros", 16, "Error"


KeyAscii = 0
End If
If KeyAscii = 13 Then
Text8.SetFocus
End If
End Sub
Private Sub Text8_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 46
Then
Else
MsgBox "Debe de ingresar solo numeros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Text9.SetFocus
End If
End Sub
Private Sub Text9_KeyPress(KeyAscii As Integer)
If (KeyAscii >= 48 And KeyAscii <= 57) Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 46
Then
Else
MsgBox "Debe de ingresar solo numeros", 16, "Error"
KeyAscii = 0
End If
If KeyAscii = 13 Then
Command1.SetFocus

End If
End Sub

Вам также может понравиться