Densidad

Anuncio
densidad.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
03/05/2005 21:58
'-----------------------------------------------------------------------------'// Programa ..... Densidad
'// Autor ........ Jesús P.M. (zttSoft.com)
'// Fecha ........ 10/03/2005 * Mod 28/04/2005
'-----------------------------------------------------------------------------Option Explicit
Dim Variable As Byte
'-----------------------------------------------------------------------------Private Sub Form_Activate()
txtVariable(1).SetFocus
Variable = 0
txtVariable(0).Text = CDbl(txtVariable(0).Text)
txtVariable(1).Text = CDbl(txtVariable(1).Text)
txtVariable(2).Text = CDbl(txtVariable(2).Text)
End Sub
'-----------------------------------------------------------------------------Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Move 6015, 3120
Image2.Move 4680, 3120
Image3.Move 7380, 3120
End Sub
'-----------------------------------------------------------------------------Private Sub Image1_Click()
txtVariable(0).Text = 0
txtVariable(1).Text = 0
txtVariable(2).Text = 0
lblResultado.Caption = Format(0, "#,##0.00")
End Sub
'-----------------------------------------------------------------------------Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image1.Move 5965, 3070
End Sub
'-----------------------------------------------------------------------------Private Sub Image2_Click()
End
End Sub
'-----------------------------------------------------------------------------Private Sub Image2_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image2.Move 4630, 3070
End Sub
'-----------------------------------------------------------------------------Private Sub Image3_Click()
Dim Resultado As Double
On Error GoTo ControlError
If IsNumeric(txtVariable(0).Text) And IsNumeric(txtVariable(1).Text) And IsNumeric(tx
Select Case Variable
Case 0 'Densidad
Resultado = CDbl(txtVariable(1).Text) / CDbl(txtVariable(2).Text)
Case 1 'Masa
Resultado = txtVariable(0).Text * txtVariable(2).Text
Case 2 'Volumen
Resultado = txtVariable(1).Text / txtVariable(0).Text
End Select
lblResultado.Caption = Format(Resultado, "#,##0.00")
Else
MsgBox "LOS VALORES DEBEN SER NÚMEROS ", 16, "¡ERROR!"
End If
Exit Sub
ControlError:
MsgBox Err.Description, 16, "¡ERROR!"
Resume Next
End Sub
'-----------------------------------------------------------------------------Private Sub Image3_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Image3.Move 7320, 3070
End Sub
'-----------------------------------------------------------------------------Private Sub optVariable_Click(Index As Integer)
Select Case Index
Case 0 'Densidad
txtVariable(0).Enabled = False
txtVariable(1).Enabled = True
txtVariable(2).Enabled = True
txtVariable(1).SetFocus
Page 1 of 2
densidad.txt
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
03/05/2005 21:58
lblVarCalculada.Caption = "Densidad: D=M/V"
Case 1 'Masa
txtVariable(0).Enabled = True
txtVariable(1).Enabled = False
txtVariable(2).Enabled = True
txtVariable(0).SetFocus
lblVarCalculada.Caption = "Masa: M=D·V"
Case 2 'Volumen
txtVariable(0).Enabled = True
txtVariable(1).Enabled = True
txtVariable(2).Enabled = False
txtVariable(0).SetFocus
lblVarCalculada.Caption = "Volumen: V=M/D"
End Select
Variable = Index
End Sub
'-----------------------------------------------------------------------------Private Sub txtVariable_GotFocus(Index As Integer)
txtVariable(Index).SelStart = 0
txtVariable(Index).SelLength = Len(txtVariable(Index).Text)
End Sub
'-----------------------------------------------------------------------------Private Sub txtVariable_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then 'INTRO=13 o CTRL+INTRO=10
'KeyAscii = 0 ' QUITA EL BEEP DEL INTRO
SendKeys "{TAB}"
End If
If KeyAscii = 46 Then 'Coma=44 Punto=46
KeyAscii = 44 ' Cambiar a punto
End If
End Sub
'-----------------------------------------------------------------------------'---------------------- FIN ------------------------------------------
Page 2 of 2
Descargar