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:
- Add/Remove Rows and validating each cells in DataGridView Control
- Basic Calculator Using Java with GUI
- How to Get Pixel Color and Name from the Screen Using VB.Net
(Visited 144 times, 1 visits today)