Hi,
I have designed a time converter (with the help of this forum members) which you see below:
![Name: Untitled.png
Views: 73
Size: 23.9 KB]()
The text box just accept integer numbers. I want to develope my code and do some basic calculations in the text box and then take it as an input for time conversion. For example, I want to write this in the text box:
23+(6*54)+40+(2*21)
When I press the calculation button, the expression above need to be calculated firstly and then, its answer be taken as an input for my previous code.
My current code is:
Please help me out. I'm new to VB.Net and need some guidance in the codes to learn their functions.
Thanks.
I have designed a time converter (with the help of this forum members) which you see below:
The text box just accept integer numbers. I want to develope my code and do some basic calculations in the text box and then take it as an input for time conversion. For example, I want to write this in the text box:
23+(6*54)+40+(2*21)
When I press the calculation button, the expression above need to be calculated firstly and then, its answer be taken as an input for my previous code.
My current code is:
Code:
blic Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim minutes As Integer
If (Not Integer.TryParse(TextBox1.Text, minutes)) Then
MessageBox.Show("please enter a valid number without decimals.", "Invalid Form", MessageBoxButtons.OK)
Return
End If
Dim timespanconversion As New TimeSpan(0, minutes, 0)
Label3.Text = $"Answer is: {timespanconversion.Days}D-{timespanconversion.Hours}h:{timespanconversion.Minutes}m"
Label3.ForeColor = Color.Red
End Sub
End Class
Thanks.