how to convert weeks to days into textbox with VB site:stackoverflow.com

The solution for “how to convert weeks to days into textbox with VB site:stackoverflow.com” can be found here. The following code will assist you in solving the problem.

‘TextBox1 is where the user inputs the number of minutes
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
Dim d = TimeSpan.FromMinutes(TextBox1.Text) ‘creates a TimeSpan based on user input, this is also a variable creation

TextBox5.Text = d.ToString(“dd\:hh\:mm”) ‘you can format it with a custom format

‘Or you can access the elements of the TimeSpan like so

TextBox2.Text = d.Days
TextBox3.Text = d.Hours
TextBox4.Text = d.Minutes
End Sub

Thank you for using DeclareCode; We hope you were able to resolve the issue.

More questions on [categories-list]

Similar Posts