How to Count or Calculate Days in Visual Basic.Net

0
758

This tutorial is all about How to Count or Calculate Days in Visual Basic.Net. With this tutorial you can Count or Calculate Days in Visual Basic.Net easily. So let’s get started:

  • First is open the Visual Basic, Select File on the menu, then click New and create a new project.

  • Then a New Project Dialog will appear. You can rename your project, depending on what you like to name it. After that click OK

  • Design your form like this just like what I’ve shown you below.
    Add 2 DatetimePicker, 3 Label, Textbox and a Button.
  • After Designing your form, Add this code to the button.

[vbnet]

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim First As Date
Dim Second As Date
Dim Result As New TimeSpan()
First = DateTimePicker1.Value
Second = DateTimePicker2.Value
Result = Second – First
Me.TextBox1.Text = FormatNumber(Result.TotalDays.ToString, 2)
End Sub

[/vbnet]

  • Finally, Click F5 to run Program.

Output:

If you have any comments or suggestion about on How to Count or Calculate Days in Visual Basic.Net, Please Feel Free to contact our webpage.

Download How to Count or Calculate Days in Visual Basic.Net Code Here

 

Other articles you might read also:

 

 

 

 

Looking for more source code? Type your keyword here here!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.