How to Count or Calculate Days in Visual Basic.Net


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.


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


  • Finally, Click F5 to run Program.


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!


Please enter your comment!
Please enter your name here

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