הערה
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות להיכנס או לשנות מדריכי כתובות.
הגישה לדף זה מחייבת הרשאה. באפשרותך לנסות לשנות מדריכי כתובות.
Question
Monday, January 30, 2017 2:06 AM
I am using VB 2008 and MS Access database to develop an Windows Form Application.I have a field ScheduledTime where client fill time scheduled.I want to know how to use DateTimePicker to get time only..I tried changing format to Time but while storing data it saves time and date in record...I want to save time only
Your reply will be most helpful...
All replies (5)
Tuesday, February 7, 2017 1:54 PM ✅Answered
I have set the format of datetimepicker as time and set showupdown property to true...It works on fine but in datagridview it displays time followed by default date ...What can I do to solve this problem
Edit the columns for the datagridview. Go to this "time" column, select the Default Cell Style and enter a time format string for the Format property.
Reed Kimble - "When you do things right, people won't be sure you've done anything at all"
Monday, January 30, 2017 4:37 AM
I tried changing format to Time but while storing data it saves time and date in record...I want to save time only
If the database field is a datetime field then it will always have a date as well as the time. The format of the datetimepicker is not relevant. If you initialise a datetime field with a time the system will add a default date.
If you aren't interested in the date then when you display the field you should format it to display the time portion only. It may simplify things if you force the date portion to an arbitrary date (eg, 1/1/1) before saving it.
If the database field is something other than a datetime then your options depend on what the type of the field is.
Tuesday, February 7, 2017 12:10 PM
I have set the format of datetimepicker as time and set showupdown property to true...It works on fine but in datagridview it displays time followed by default date ...What can I do to solve this problem
Tuesday, February 7, 2017 12:26 PM | 1 vote
For a DataGridView do you want something like this. If so I have a MSDN code sample for this.
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
VB Forums - moderator
Wednesday, February 15, 2017 2:02 PM
Hello Mr. Reed Kimble , You are my saviour...Thank you so much.When I started my project I had my doubts.But whenever I got stuck , you got me out of problem with ease...Your valuable help made completion of my project possible.