tags:

views:

16

answers:

2

i have a datetimepicker box on a form that gets its value from a datagrid (only date) i am trying to assign the string date value from the grid to the datetimepicker box, but is not working

A: 

You may want to start here: http://www.exforsys.com/tutorials/vb.net-2005/common-windows-form-controls-section-2.html

But essentially, do a check to validate your string is a date (IsDate(object) Returns Boolean), Convert the String to a Date (CDate(String)) and then assign the DateTimePicker.Value to the converted string.

Josaph
A: 

if your Cell has a custom Format, then use:

Dim DateValue = Date.ParseExact(Str, YourCustomFormat, Nothing)

x77
DateTimePicker has a Text Property and Value Property. You can assign also to Text Property.
x77