• Top Members
  • 834 Replies
    2585 Replies
  • 716 Replies
    2026 Replies
  • 331 Replies
    1928 Replies

Multidates adding and loading in db and vb

Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
User avatar
VIP - Donator
Posts: 1983

Multidates adding and loading in db and vb

Wed May 01, 2019 10:31 am


I was wondering if someone can helpme out
i really want to explore my own calendar but i need to allow to add multi dates into it
like when we on a holiday so we can select from 1 till 7 days or longer
and then it will be added in out db sqlite
and when we reload the calendar form
we will see that the dates are selected that we added
and when we edit it again we can change it and also again in our db sqlite

here a sample
https://drive.google.com/file/d/1ysuwlm ... sp=sharing
https://drive.google.com/file/d/1RU2dns ... sp=sharing
you will see from 6 till 10 has a dot
that are the multi dates
so how can we do that in vb.net


User avatar
VIP - Donator
Posts: 1983

Re: Multidates adding and loading in db and vb

Sun Jun 23, 2019 8:39 am


for whom might sound interesting here's my sample how to insert multi dates in your db
if you don't want to add weekends so just don't select after Friday then :D
and works like a charm

Code: Select all

                Dim date_in As DateTime = Convert.ToDateTime(DateTimePicker3.Value)'begin date
                Dim date_out As DateTime = Convert.ToDateTime(DateTimePicker1.Value)'end date
                Dim date_cal As DateTime = Convert.ToDateTime(DateTimePicker2.Value)
                Dim days As TimeSpan = date_out.Subtract(date_in)
                Dim ds As String

                If Convert.ToInt32(days.Days) >= 0 Then
                    For index = 0 To days.Days
                        ds = date_cal.AddDays(index)
                        DateTimePicker2.Value = ds
                        End If
                    MessageBox.Show("Please Check It's Invalid Input")
                End If

so it will be starting from date_in and then checks the days and add them one by one into your db :D
hope you can use it.

- and still working on the loading it all again
to change it.
but that's for later.
have fun

Post Reply

Return to “Tutorial Requests”