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.
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  2. Dim First As Date
  3. Dim Second As Date
  4. Dim Result As New TimeSpan()
  5. First = DateTimePicker1.Value
  6. Second = DateTimePicker2.Value
  7. Result = Second - First
  8. Me.TextBox1.Text = FormatNumber(Result.TotalDays.ToString, 2)
  9. 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:





Facebook Comments
(Visited 158 times, 1 visits today)


Please enter your comment!
Please enter your name here