3 Replies - 41285 Views - Last Post: 27 April 2009 - 02:19 PM Rate Topic: -----

#1 Mahey   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 42
  • Joined: 22-April 09

DataGridView - Date column [Input format dd/MM/yyyy]

Posted 26 April 2009 - 11:39 PM

Hi,

With my datagridview I have column for datetime. I added the column with datagridview like the following.

dim secidexp As New DataGridViewTextBoxColumn
With secidexp
			.MaxInputLength = 10
			.DataPropertyName = "sec_id_expiry"
			.HeaderText = "ID EXPIRY DATE"
			.DefaultCellStyle.Format = "dd/MM/yyyy"

End With
Mydatagrid1.Columns.Add(secidexp) [code]

But the problem is it's getting input like MM/dd/yyyy and after pressing enter it's changing to dd/mm/yyyy style.

So is it possible to get input like "dd/MM/yyyy"

I received the Help.But not clear to me. So where to handle it for reading the specific format?
Bettear Ideas Are Always Welcome.

This post has been edited by Mahey: 26 April 2009 - 11:41 PM


Is This A Good Question/Topic? 0
  • +

Replies To: DataGridView - Date column [Input format dd/MM/yyyy]

#2 June7   User is offline

  • D.I.C Addict
  • member icon

Reputation: 104
  • View blog
  • Posts: 904
  • Joined: 09-December 08

Re: DataGridView - Date column [Input format dd/MM/yyyy]

Posted 27 April 2009 - 01:01 AM

Quote

But the problem is it's getting input like MM/dd/yyyy and after pressing enter it's changing to dd/mm/yyyy style.
So is it possible to get input like "dd/MM/yyyy"


Am confused, which way do you want to display? Your code is for dd/mm/yyyy, you get this, and are asking if possible. Might suggest dd/mmm/yyyy. The mmm will return 3-letter month like 'Jan'.

This post has been edited by June7: 27 April 2009 - 01:04 AM

Was This Post Helpful? 0
  • +
  • -

#3 Mahey   User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 42
  • Joined: 22-April 09

Re: DataGridView - Date column [Input format dd/MM/yyyy]

Posted 27 April 2009 - 01:27 AM

View PostJune7, on 27 Apr, 2009 - 12:01 AM, said:

Quote

But the problem is it's getting input like MM/dd/yyyy and after pressing enter it's changing to dd/mm/yyyy style.
So is it possible to get input like "dd/MM/yyyy"


Am confused, which way do you want to display? Your code is for dd/mm/yyyy, you get this, and are asking if possible. Might suggest dd/mmm/yyyy. The mmm will return 3-letter month like 'Jan'.


Thanks But, Iam not looking to display the readed value.
I need to get Input by dd/MM/yyyy format. But the default style for datetime is MM/dd/yyyy. Is it not?

The Format command is displaying the data [already from table] in dd/MM/yyyy. ok. Fine. But if you are adding a new value in datagridview, the date field is getting Input by MM/dd/yyyy for new rows.

The problem is there !!!!!!!!!
Was This Post Helpful? 0
  • +
  • -

#4 June7   User is offline

  • D.I.C Addict
  • member icon

Reputation: 104
  • View blog
  • Posts: 904
  • Joined: 09-December 08

Re: DataGridView - Date column [Input format dd/MM/yyyy]

Posted 27 April 2009 - 02:19 PM

Maybe I understand now.
If this weren't date type data, I would say use an input mask, but skeptical it will work if table field is date type. Here is example of input mask I use: 99/99/"20"00;0;
But input is still by mm/dd/yyyy.

You could use separate text boxes for day, month, year and concatenate in code for saving to table.

This post has been edited by June7: 27 April 2009 - 02:33 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1