OpenNetCF DateTimePicker control-CustomFormat

P

paulnewton44

I cannot assign a custom date format for the OpenNetCF DateTimePicker
control, it just seems to ignore the setting.

I need the setting to be "dd/mm/yy", but it defaults to "mm/dd/yy"

I have the following code in my form's Load event...

Dim mPicker As OpenNETCF.Windows.Forms.DateTimePicker

mPicker = New OpenNETCF.Windows.Forms.DateTimePicker
mPicker.CustomFormat = "dd/mm/yy"
mPicker.Format = OpenNETCF.Windows.Forms.DateTimePickerFormat.Custom

mPicker.Bounds = New Rectangle(40, 6, 100, 20)
Me.Controls.Add(mPicker)

I am using v1.4 of OpenNetCF, I have read threads with other guys
having the same issue, but I have not seen any fixes..


TIA


Paul Newton
 
P

paulnewton44

Sergey,

Thanks for your reply..

I am fairly new to VB.NET CF, so please bear with me..

I think I have done what you said, but the date is still not in the
correct format..

Here is my code..........

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

' instantiate OpenNETCF DateTimePicker control on the form
mPicker = New OpenNETCF.Windows.Forms.DateTimePicker
Me.Controls.Add(mPicker)
Me.Refresh()

End Sub


Private Sub frmOrderFilter_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load

Me.Refresh()
Try
' Note, set locale to UK on the device, .CustomFormat
property does not work in OpenNETCF v1.4
mPicker.CustomFormat = "dd/mm/yy"
mPicker.Format =
OpenNETCF.Windows.Forms.DateTimePickerFormat.Custom

mPicker.Bounds = New Rectangle(55, 6, 100, 20)
Catch ex As Exception
MessageBox.Show(ex.Message & " failed to load OpenNETCF
DateTimePicker")
Me.Close()
End Try

Me.Refresh()


End Sub


Thanks





Sergey said:
See this thread:
http://groups.google.com/group/micr...ab633b6f033/1108f20f55e2941b#1108f20f55e2941b

Instantiate DateTimePicker & add into a form in the constructor, but
modify CustomFormat property in the Load event.

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


I cannot assign a custom date format for the OpenNetCF DateTimePicker
control, it just seems to ignore the setting.

I need the setting to be "dd/mm/yy", but it defaults to "mm/dd/yy"

I have the following code in my form's Load event...

Dim mPicker As OpenNETCF.Windows.Forms.DateTimePicker

mPicker = New OpenNETCF.Windows.Forms.DateTimePicker
mPicker.CustomFormat = "dd/mm/yy"
mPicker.Format = OpenNETCF.Windows.Forms.DateTimePickerFormat.Custom

mPicker.Bounds = New Rectangle(40, 6, 100, 20)
Me.Controls.Add(mPicker)

I am using v1.4 of OpenNetCF, I have read threads with other guys
having the same issue, but I have not seen any fixes..


TIA


Paul Newton
 
S

Sergey Bogdanov

It seems that everything is ok for me, except one thing - change
CustomFormat from "dd/mm/yy" to "dd/MM/yy".


--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Sergey,

Thanks for your reply..

I am fairly new to VB.NET CF, so please bear with me..

I think I have done what you said, but the date is still not in the
correct format..

Here is my code..........

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

' instantiate OpenNETCF DateTimePicker control on the form
mPicker = New OpenNETCF.Windows.Forms.DateTimePicker
Me.Controls.Add(mPicker)
Me.Refresh()

End Sub


Private Sub frmOrderFilter_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load

Me.Refresh()
Try
' Note, set locale to UK on the device, .CustomFormat
property does not work in OpenNETCF v1.4
mPicker.CustomFormat = "dd/mm/yy"
mPicker.Format =
OpenNETCF.Windows.Forms.DateTimePickerFormat.Custom

mPicker.Bounds = New Rectangle(55, 6, 100, 20)
Catch ex As Exception
MessageBox.Show(ex.Message & " failed to load OpenNETCF
DateTimePicker")
Me.Close()
End Try

Me.Refresh()


End Sub


Thanks





Sergey said:
See this thread:
http://groups.google.com/group/micr...ab633b6f033/1108f20f55e2941b#1108f20f55e2941b

Instantiate DateTimePicker & add into a form in the constructor, but
modify CustomFormat property in the Load event.

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


I cannot assign a custom date format for the OpenNetCF DateTimePicker
control, it just seems to ignore the setting.

I need the setting to be "dd/mm/yy", but it defaults to "mm/dd/yy"

I have the following code in my form's Load event...

Dim mPicker As OpenNETCF.Windows.Forms.DateTimePicker

mPicker = New OpenNETCF.Windows.Forms.DateTimePicker
mPicker.CustomFormat = "dd/mm/yy"
mPicker.Format = OpenNETCF.Windows.Forms.DateTimePickerFormat.Custom

mPicker.Bounds = New Rectangle(40, 6, 100, 20)
Me.Controls.Add(mPicker)

I am using v1.4 of OpenNetCF, I have read threads with other guys
having the same issue, but I have not seen any fixes..


TIA


Paul Newton
 
P

paulnewton44

Sergey,

Many thanks, with your help the datepicker now works as I want..

Another question....
Do you have any sample code for setting the Locale of the device?

I need to set it to UK so that the date format defaults to dd/MM/yy


Thanks...



Sergey said:
It seems that everything is ok for me, except one thing - change
CustomFormat from "dd/mm/yy" to "dd/MM/yy".


--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


Sergey,

Thanks for your reply..

I am fairly new to VB.NET CF, so please bear with me..

I think I have done what you said, but the date is still not in the
correct format..

Here is my code..........

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

' instantiate OpenNETCF DateTimePicker control on the form
mPicker = New OpenNETCF.Windows.Forms.DateTimePicker
Me.Controls.Add(mPicker)
Me.Refresh()

End Sub


Private Sub frmOrderFilter_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load

Me.Refresh()
Try
' Note, set locale to UK on the device, .CustomFormat
property does not work in OpenNETCF v1.4
mPicker.CustomFormat = "dd/mm/yy"
mPicker.Format =
OpenNETCF.Windows.Forms.DateTimePickerFormat.Custom

mPicker.Bounds = New Rectangle(55, 6, 100, 20)
Catch ex As Exception
MessageBox.Show(ex.Message & " failed to load OpenNETCF
DateTimePicker")
Me.Close()
End Try

Me.Refresh()


End Sub


Thanks





Sergey said:
See this thread:
http://groups.google.com/group/micr...ab633b6f033/1108f20f55e2941b#1108f20f55e2941b

Instantiate DateTimePicker & add into a form in the constructor, but
modify CustomFormat property in the Load event.

--
Sergey Bogdanov [.NET CF MVP, MCSD]
http://www.sergeybogdanov.com


(e-mail address removed) wrote:

I cannot assign a custom date format for the OpenNetCF DateTimePicker
control, it just seems to ignore the setting.

I need the setting to be "dd/mm/yy", but it defaults to "mm/dd/yy"

I have the following code in my form's Load event...

Dim mPicker As OpenNETCF.Windows.Forms.DateTimePicker

mPicker = New OpenNETCF.Windows.Forms.DateTimePicker
mPicker.CustomFormat = "dd/mm/yy"
mPicker.Format = OpenNETCF.Windows.Forms.DateTimePickerFormat.Custom

mPicker.Bounds = New Rectangle(40, 6, 100, 20)
Me.Controls.Add(mPicker)

I am using v1.4 of OpenNetCF, I have read threads with other guys
having the same issue, but I have not seen any fixes..


TIA


Paul Newton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top