You are on page 1of 7

Private Sub Command1_Click()

Dim vel, vi, de, dint As Double

Dim NR, rug, f, Er As Double

Dim ap, t As Double

vel = Val(Text1.Text)

vi = Val(Text2.Text)

de = Val(Text3.Text)

dint = Val(Text7.Text)

rug = 0.00006

NR = (vel * dint * de) / vi

Text4.Text = NR

Select Case NR

Case Is < 2000

Text5.BackColor = RGB(0, 255, 0)

Text5.Text = "FLUJO LAMINAR"

f = 64 / NR

Text6.Text = f

Laminar.Visible = True

Label5.Visible = True

Case Is > 4000

Er = (de * vel * rug) / vi

If Er < 5 Then
f = 0.3164 / NR ^ 0.25

Text5.BackColor = RGB(255, 0, 0)

Text5.Text = "FLUJO TURBULENTO LISO"

Text6.Text = f

End If

If Er > 5 And Er < 70 Then

t = (f) ^ 0.5

ap = 1 / (f ^ 0.5)

For t = 1 To ap Step 0.0001

ap = 1.14 - 2 * Log(rug + (9.35 * t / NR))

f=t^2

Exit For

Next

Text5.BackColor = RGB(255, 0, 0)

Text5.Text = "FLUJO TURBULENTO TRANSICIONAL"

Text6.Text = f

End If

If Er > 70 Then

f = 1 / (1.14 - 2 * Log(Er)) ^ 2

Text5.BackColor = RGB(255, 0, 0)

Text5.Text = "FLUJO TURBULENTO RUGOSO"

Text6.Text = f

End If
End Select

End Sub

Private Sub Command2_Click()

Text1.Text = ""

Text2.Text = ""

Text3.Text = ""

Text4.Text = ""

Text5.Text = ""

Text6.Text = ""

Text7.Text = ""

Text5.BackColor = RGB(255, 255, 255)

Text1.SetFocus

End Sub

Private Sub Command3_Click()

CMD.ShowPrinter

Printer.Print "Las Variables ingresadas son"

Printer.Print ""

Printer.Print "Velocidad"

Printer.Print (Text1.Text)

Printer.Print "Viscosidad"

Printer.Print (Text2.Text)

Printer.Print "Densidad"
Printer.Print (Text3.Text)

Printer.Print "Diametro interno"

Printer.Print (Text7.Text)

Printer.Print ""

Printer.Print "El numero de Reynolds"

Printer.Print (Text4.Text)

Printer.Print ""

Printer.Print "El Flujo es de tipo"

Printer.Print (Text5.Text)

Printer.Print ""

Printer.Print "Se utilizo la ecuacion"

Printer.Print (Label6.Caption)

Printer.Print ""

Printer.Print "El factor de friccion calculado es:"

Printer.Print (Text6.Text)

Printer.EndDoc

End Sub

Private Sub Command4_Click()

End

End Sub

Private Sub Command5_Click()

MsgBox "Debes ingresar las variables pedidas por el programa y posteriormente


el mismo te calculara el factor de friccion", vbInformation, "Ayuda"

End Sub
Private Sub Form_Load()

Laminar.Visible = False

Label5.Visible = False

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 And Text1.Text <> "" Then

If Val(Text1.Text) < 15 Then

Text2.SetFocus

End If

End If

If Not ((Chr(KeyAscii) >= "0" And Chr(KeyAscii) <= "9") Or (Chr(KeyAscii) <= "/"
Or Chr(KeyAscii) = "E")) Then

Text1.Text = ""

Beep: KeyAscii = 0

End If

End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 And Text2.Text <> "" Then

If Val(Text2.Text) < 15 Then

Text2.SetFocus
End If

End If

If Not ((Chr(KeyAscii) >= "0" And Chr(KeyAscii) <= "9") Or (Chr(KeyAscii) <= "/"
Or Chr(KeyAscii) = "E")) Then

Text2.Text = ""

Beep: KeyAscii = 0

End If

End Sub

Private Sub Text3_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 And Text3.Text <> "" Then

If Val(Text3.Text) < 15 Then

Text2.SetFocus

End If

End If

If Not ((Chr(KeyAscii) >= "0" And Chr(KeyAscii) <= "9") Or (Chr(KeyAscii) <= "/"
Or Chr(KeyAscii) = "E")) Then

Text3.Text = ""

Beep: KeyAscii = 0

End If

End Sub

Private Sub Text7_KeyPress(KeyAscii As Integer)

If KeyAscii = 13 And Text7.Text <> "" Then


If Val(Text7.Text) < 15 Then

Text2.SetFocus

End If

End If

If Not ((Chr(KeyAscii) >= "0" And Chr(KeyAscii) <= "9") Or (Chr(KeyAscii) <= "/"
Or Chr(KeyAscii) = "E")) Then

Text7.Text = ""

Beep: KeyAscii = 0

End If

End Sub

You might also like