Start and End Times - Calculating

ppirates

Member
Joined
Jul 19, 2006
Messages
12
Programming Experience
10+
I am trying to write calender appointments to Outlook from a VB 2005 app and have got everything working apart from the Start and End Dates and time.

I have 4 datetimepicker controls on my form for the following...

Start Date
Start Time
End Date
End Time

I need to get the Start date and Start time to join together to be put forward as the appointment start time in Outlook, but I can't connect them.
Is there some simple command for joining the date and time together?
Or perhaps I just need to have one datetimepicker control rather than 2 for each date/time combination.

When I look at the Outlook appointment form, it has dates and times seperated, and that is what I have replicated in my form.

Any help on this would be much appreciated.

Thanks
Colin
 

Cheetah

Well-known member
Joined
Oct 12, 2006
Messages
232
Programming Experience
Beginner
Type this in and intellisense will show you what to type in for the properties.

VB.NET:
Dim newDate As Date = New Timespan(
 

Cheetah

Well-known member
Joined
Oct 12, 2006
Messages
232
Programming Experience
Beginner
That might be because what I said was incorrect...sorry.

Here is what you want:

VB.NET:
        Dim year As Integer
        Dim month As Integer
        Dim Day As Integer
        Dim hour As Integer
        Dim minute As Integer
        Dim second As Integer

        Dim newDate As New Date(year, month, Day, hour, minute, second)

Pretty self explanatory. Just input the properties of your datetimepickers
 

JohnH

VB.NET Forum Moderator
Staff member
Joined
Dec 17, 2005
Messages
15,553
Location
Norway
Programming Experience
10+
The DateTime structure is the implementation of the Date data type, in other words the same thing, but you use the data type. It's same for other data types, you use String and Integer data types and not System.String class or System.Int32 structure etc.

As for DateTimePicker you can set Format to Time or a custom, to let user select both date and time through one control.
 
Top Bottom