Please help me. I know this kind a simple problem. My problem is when i select the end day of the month it gives me a negative days
in txtdays.
This is my code to txtdays

txtDays.Text = dtpEnd.Value.Day - dtpStart.Value.Day

This is my code to add date to datetimepicker

Private Sub dtpStart_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles dtpStart.ValueChanged

        dtpEnd.Value = dtpStart.Value.AddDays(2.0)

    End Sub

Please help me
Thanks in advance!!

Recommended Answers

All 2 Replies

>My problem is when i select the end day of the month it gives me a negative days in txtdays.

Dim tm as TimeSpan
tm=  dtpEnd.Value - dtpStart.Value
txtDays.Text= tm.Days.ToString()

Thanks my friend
It works!!

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.