0

我只想分享我的问题的答案。这是代码:

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    Dim NextTime As Date = Now
    TextBox1.Text = NextTime.AddDays("set a count here".0) ' for example (100.0)
End Sub

这可用于截止日期或日期计数器。

4

1 回答 1

2
Dim newDate As DateTime = DateTime.Parse(Label1.Text).AddMonths(6)

Duedate.text = newDate.ToString

You need to make sure the format is correct though, this can be done with the following bit of code:

Dim pattern As String = "MM-dd-yy" 
Dim parsedDate As Date 

   If DateTime.TryParseExact(Label1.Text, pattern, Nothing, 
                             DateTimeStyles.None, parsedDate) Then
      Console.WriteLine("We're good!)
   Else
      Console.WriteLine("Unable to convert")
   End If                                                          
于 2013-10-28T07:59:41.217 回答