# include < iostream.h >
# include < conio.h >
Public Class Form1
Public gethr, getmin, getsec, gethr1, getmin1, getsec1, total1, total2, finaltotal, hr1, hr2, diffhr, min1, sec1 As Integer
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked = True Then
TextBox10.Text = TextBox10.Text + "-" + TextBox1.Text + "-" + TextBox2.Text + "-" + TextBox3.Text + "-" + ComboBox1.SelectedText
gethr = Val(TextBox1.Text.ToString)
getmin = Val(TextBox2.Text.ToString)
getsec = Val(TextBox3.Text.ToString)
total1 = (gethr * 3600) + (getmin * 60) + (getsec)
End If
End Sub
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
If CheckBox2.Checked = True Then
TextBox11.Text = TextBox11.Text + "-" + TextBox4.Text + "-" + TextBox5.Text + "-" + TextBox6.Text + "-" + ComboBox2.SelectedText
gethr1 = Val(TextBox4.Text.ToString)
getmin1 = Val(TextBox5.Text.ToString)
getsec1 = Val(TextBox6.Text.ToString)
total2 = (gethr1 * 3600) + (getmin1 * 60) + (getsec1)
If ComboBox1.SelectedIndex = 0 And ComboBox2.SelectedIndex = 1 Then
total1 = total1 + 12 * 3600
ElseIf ComboBox1.SelectedIndex = 1 And ComboBox2.SelectedIndex = 0 Then
total1 = total1 + 12 * 3600
ElseIf ComboBox1.SelectedIndex = 0 And ComboBox2.SelectedIndex = 0 Then
total1 = total1
ElseIf ComboBox2.SelectedIndex = 0 And ComboBox1.SelectedIndex = 0 Then
total1 = total1
End If
finaltotal = (Math.Abs(total1 - total2))
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ComboBox1.Items.Add("Am")
ComboBox1.Items.Add("Pm")
ComboBox2.Items.Add("Am")
ComboBox2.Items.Add("Pm6")
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If finaltotal <= 60 Then
TextBox7.Text = "0"
TextBox8.Text = "0"
TextBox9.Text = Math.Floor(finaltotal)
ElseIf finaltotal > 60 And finaltotal < 3600 Then
TextBox7.Text = "0"
TextBox8.Text = Math.Floor(finaltotal / 60)
TextBox9.Text = Math.Floor(finaltotal Mod 60)
ElseIf finaltotal >= 3600 Then
hr1 = Math.Floor(finaltotal / 3600)
TextBox7.Text = hr1
hr2 = hr1 * 3600
diffhr = finaltotal - hr2
min1 = Math.Floor(diffhr / 60)
TextBox8.Text = min1
sec1 = finaltotal Mod 60
TextBox9.Text = sec1
End If
End Sub
End Class
Visual Basic supports a number of ways of converting from one type to another. The conversion function would take such a value , String, expression and attempt to convert it. It the conversion