You are on page 1of 10

Dim q, s, n, b, m, r, y As Single

Private Sub Command1_Click()


If Label1.ForeColor = &H0& Or Label2.ForeColor = &H0& Or Label3.ForeColor =
&H0& Then
MsgBox "Pick cross-sectional area"
End If
If Label1.ForeColor = &HC00000 And Option1 = True Then
q = Val(Text1.Text)
s = Val(Text2.Text)
n = Val(Text3.Text)
b = Val(Text4.Text)
r = Val(Text6.Text)

If q = "0" Or s = "0" Or n = "0" Or b = "0" Or r = "0" Then


MsgBox " fill the blank/s"

ElseIf s > 0.1 Or s < 0.0001 Then


MsgBox " S values should be from 0.0001 to 0.1 only"

ElseIf n > 0.15 Or n < 0.01 Then


MsgBox " n values should be from 0.01 to 0.15 only"

Else

l=q*n
p = s ^ (1 / 2)
k = r ^ (2 / 3)

A = l / (p * k)

y=A/b

Text7.Text = y

End If
End If

If Label1.ForeColor = &HC00000 And Option2 = True Then


q = Val(Text1.Text)
s = Val(Text2.Text)
n = Val(Text3.Text)
b = Val(Text4.Text)
r = Val(Text6.Text)

If q = "0" Or s = "0" Or n = "0" Or b = "0" Or r = "0" Then


MsgBox " fill the blank/s"

ElseIf s > 0.1 Or s < 0.0001 Then


MsgBox " S values should be from 0.0001 to 0.1 only"

ElseIf n > 0.15 Or n < 0.01 Then


MsgBox " n values should be from 0.01 to 0.15 only"

Else

l=q*n

p = s ^ (1 / 2)
k = r ^ (2 / 3)

A = l / (1.49 * p * k)

y=A/b

Text7.Text = y

End If
End If

If Label2.ForeColor = &HC00000 And Option1 = True Then


q = Val(Text1.Text)
s = Val(Text2.Text)
n = Val(Text3.Text)
b = Val(Text4.Text)
m = Val(Text5.Text)
r = Val(Text6.Text)

If q = "0" Or s = "0" Or n = "0" Or b = "0" Or r = "0" Or m = "0" Then


MsgBox " fill the blank/s"

ElseIf s > 0.1 Or s < 0.0001 Then


MsgBox " S values should be from 0.0001 to 0.1 only"

ElseIf n > 0.15 Or n < 0.01 Then


MsgBox " n values should be from 0.01 to 0.15 only"

Else

l=q*n
p = s ^ (1 / 2)
k = r ^ (2 / 3)

A = l / (p * k)

h=A*m
z = ((b ^ 2) + (4 * h)) ^ (1 / 2)

y = (z - b) / 2

Text7.Text = y

End If
End If

If Label2.ForeColor = &HC00000 And Option2 = True Then


q = Val(Text1.Text)
s = Val(Text2.Text)
n = Val(Text3.Text)
b = Val(Text4.Text)
m = Val(Text5.Text)
r = Val(Text6.Text)

If q = "0" Or s = "0" Or n = "0" Or b = "0" Or r = "0" Or m = "0" Then

MsgBox " fill the blank/s"

ElseIf s > 0.1 Or s < 0.0001 Then


MsgBox " S values should be from 0.0001 to 0.1 only"

ElseIf n > 0.15 Or n < 0.01 Then


MsgBox " n values should be from 0.01 to 0.15 only"

Else

l=q*n
p = s ^ (1 / 2)
k = r ^ (2 / 3)

A = l / (1.49 * p * k)

h=A*m
z = ((b ^ 2) + (4 * h)) ^ (1 / 2)

y = (z - b) / 2

Text7.Text = y

End If
End If
If Label3.ForeColor = &HC00000 And Option1 = True Then
q = Val(Text1.Text)
s = Val(Text2.Text)

n = Val(Text3.Text)
m = Val(Text5.Text)
r = Val(Text6.Text)

If q = "0" Or s = "0" Or n = "0" Or r = "0" Or m = "0" Then


MsgBox " fill the blank/s"

ElseIf s > 0.1 Or s < 0.0001 Then


MsgBox " S values should be from 0.0001 to 0.1 only"

ElseIf n > 0.15 Or n < 0.01 Then


MsgBox " n values should be from 0.01 to 0.15 only"

Else

l=q*n
p = s ^ (1 / 2)
k = r ^ (2 / 3)

A = l / (p * k)

y = (A * m) ^ (1 / 2)

Text7.Text = y

End If
End If

If Label3.ForeColor = &HC00000 And Option2 = True Then


q = Val(Text1.Text)
s = Val(Text2.Text)
n = Val(Text3.Text)
m = Val(Text5.Text)
r = Val(Text6.Text)

If q = "0" Or s = "0" Or n = "0" Or r = "0" Or m = "0" Then


MsgBox " fill the blank/s"

ElseIf s > 0.1 Or s < 0.0001 Then


MsgBox " S values should be from 0.0001 to 0.1 only"

ElseIf n > 0.15 Or n < 0.01 Then


MsgBox " n values should be from 0.01 to 0.15 only"

Else

l=q*n
p = s ^ (1 / 2)
k = r ^ (2 / 3)

A = l / (1.49 * p * k)

y = (A * m) ^ (1 / 2)

Text7.Text = y

End If
End If
End Sub

Private Sub Command2_Click()


Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Text7.Text = ""
End Sub

Private Sub Command4_Click()


End
End Sub

Private Sub Label1_Click()


Label1.ForeColor = &HC00000
Label1.BackColor = &HFFFF00
Label2.BackColor = &H80000004
Label3.BackColor = &H80000004
Label2.ForeColor = &H80000012
Label3.ForeColor = &H80000012
Label8.Visible = False
Text5.Visible = False
Label7.Visible = True

Text4.Visible = True
Label13.Visible = True

End Sub

Private Sub Label2_Click()


Label2.ForeColor = &HC00000
Label2.BackColor = &HFFFF00
Label1.BackColor = &H80000004
Label3.BackColor = &H80000004
Label1.ForeColor = &H80000012
Label3.ForeColor = &H80000012
Label8.Visible = True
Text5.Visible = True
Label7.Visible = True
Text4.Visible = True
Label13.Visible = True
End Sub

Private Sub Label3_Click()


Label3.ForeColor = &HC00000
Label3.BackColor = &HFFFF00
Label1.BackColor = &H80000004
Label2.BackColor = &H80000004
Label1.ForeColor = &H80000012
Label2.ForeColor = &H80000012
Label7.Visible = False
Text4.Visible = False

Label13.Visible = False
Label8.Visible = True
Text5.Visible = True

End Sub

Private Sub Option1_Click()


Label11.Caption = "m/ s"
Label12.Caption = "m"
Label13.Caption = "m"
End Sub

Private Sub Option2_Click()


Label11.Caption = "ft/ s"
Label12.Caption = "ft"
Label13.Caption = "ft"
End Sub

You might also like