Displaying dates using vbnewline in vb.net
I have two datetime pickers in vb.net that calculate the number of days
between two dates and display in a message box the number of days. I want
the number to display in a text box using vbnewline or any method but NOT
to display in a messageBox
Private Sub btnCalculate_Click(sender As System.Object, e As
System.EventArgs)Handles btnCalculate.Click
If True Then
Dim dt1 As DateTime = Convert.ToDateTime(DateTimePicker1.Text)
Dim dt2 As DateTime = Convert.ToDateTime(DateTimePicker2.Text)
Dim ts As TimeSpan = dt2.Subtract(dt1)
If Convert.ToInt32(ts.Days) >= 0 Then
MessageBox.Show("Total Days are " & Convert.ToInt32(ts.Days))
Else
MessageBox.Show("Invalid Input")
End If
End If
End Sub
Any input appreciated
No comments:
Post a Comment