📌  相关文章
📜  如何使用 VB site:stackoverflow.com - VBA 代码示例将几周转换为几天

📅  最后修改于: 2022-03-11 14:51:56.944000             🧑  作者: Mango

代码示例1
'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