This Visual Basic code defines event handlers for two radio buttons that convert a time entered in a text box between minutes and seconds or hours and minutes. When radio button 1 is checked, it takes the value from the text box, multiplies it by 60 to convert to seconds, and displays the result along with "minutes to seconds". When radio button 2 is checked, it takes the value from the text box, divides it by 60 to get the hours and calculates the remainder to get the minutes, displaying the results with "time in hour format".
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
45 views
Exercise 9
This Visual Basic code defines event handlers for two radio buttons that convert a time entered in a text box between minutes and seconds or hours and minutes. When radio button 1 is checked, it takes the value from the text box, multiplies it by 60 to convert to seconds, and displays the result along with "minutes to seconds". When radio button 2 is checked, it takes the value from the text box, divides it by 60 to get the hours and calculates the remainder to get the minutes, displaying the results with "time in hour format".
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1
Exercise 9
Public Class Form1
Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged Me.Label2.Text = Nothing Me.Label1.Text = Val(TextBox1.Text) * 60 Me.Label3.Text = "minutes to seconds" End Sub Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged Me.Label2.Text = Val(TextBox1.Text) \ 60 Me.Label1.Text = Val(TextBox1.Text) Mod 60 Me.Label3.Text = "time in hour format" End Sub End Class