How can I use an if
in another if
in Visual Basic 6?
For example, in C++ I can start my statements with {
and finish them with }
, and I can use another if
in the first statement.
For example:
if m>3
{ .....
if a>5
{
......
}
else {....}
} else ........
… but in Visual Basic there is no {
}
or something similar it
i want to writ a program that recive a time from user and Reduce 4:30 from it ! for example when user runs it , it asks : what time is it in Tehran ? and user enter time (for example 16:30) and then program Reduces 4 hour and 30 minutes from it ! and print : GMT time is : 12:00 ! i'll updat my post and put my code ! please read it !
Option Explicit
Private Sub Command1_Click()
Cls
Dim h As Integer, m As Integer, hm As Integer, mm As Integer, t As Integer
Dim fh As String, fm As String, fhm As String, fmm As String
t = InputBox("Enter time")
h = t \ 100
m = t Mod 100
Select Case h
Case 0 To 24
If m < 60 Then
If m >= 30 Then
hm = h - 4
mm = m - 30
If h < 10 Then fh = Format(h, String(2, "0")) Else fh = h
If m < 10 Then fm = Format(m, String(2, "0")) Else fm = m
If hm < 10 Then fhm = Format(hm, String(2, "0")) Else fhm = hm
If mm < 10 Then fmm = Format(mm, String(2, "0")) Else fmm = mm
Print
Print " Tehran Time is : "; fh; ":"; fm
Print
Print " GMT Time is : "; fhm; ":";
Else
hm = h - 5
mm = m + 30
If h < 10 Then fh = Format(h, String(2, "0")) Else fh = h
If m < 10 Then fm = Format(m, String(2, "0")) Else fm = m
If hm < 10 Then fhm = Format(hm, String(2, "0")) Else fhm = hm
If mm < 10 Then fmm = Format(mm, String(2, "0")) Else fmm = mm
Print
Print " Tehran Time is : "; fh; ":"; fm
Print
Print " GMT Time is : "; fhm; ":"; fmm
End If
End If
Case Else
Beep
Print
Print " Time is wrong !!! Try again "
End Select
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Load()
End Sub