I want to do something like counting date, it's truly like this
First I click on one date time picker which called 'dtpstart'. Then I typed number of dates on text box called 'period'. After that I want to show what is the date ?
For Ex:
dtpstart = 2016.01.01
period = 10
lastdate = 2016.01.11
I want to get this last date to label.
Currently I'm trying this code : but It doesn't work.

Dim datestart As Date
        datestart = dtploanstart.Value
        Dim i As Integer
        For i 1 to 65
            datestart = dtploanstart.Value.AddDays(1)
        Next
        datestart = dtploanend.Value

can anyone help ?

Recommended Answers

All 4 Replies

I didn't understand why you got a For loop... This should work (i assumed you got an txtPeriod for entering the date)

Dim dtStart As Date = dtploanstart.Value
Dim intPeriod as Integer = CInt(txtPeriod.Text)
Dim dtEnd = dtStart.AddDays(intPeriod);

A little addition with AleMonteiro's post you can also use DateAdd() fuction to get your desired date.
The syntax is
DateAdd(DateInterval As Microsoft.VisualBasic.DateInterval,Number As Double,DateVAlue As Date)

 LabelEndDate.Text = DateAdd(DateInterval.Day, Val(TextBox1.Text), dtploanstart.Value)

thank you sir I got idea :)
what ever can I skiped some days from counting this days....
I mean skiping holidays

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.