datagridview displays 4 digit yrs on cmptr1 and 2 digit yrs on cmp

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?UmljaA==?=

    datagridview displays 4 digit yrs on cmptr1 and 2 digit yrs on cmp

    Using VB2005, a datagridview is displaying the dates with 4 digit years on
    one workstation but displays the dates of the exact same records with only 2
    digit years on a 2nd workstation. I will guess that it may be an environment
    setting on the other workstation. But how can I make the datagridview
    display the dates in the same format consistently for all workstations?

    The data is coming from a sql Server 2000 table.

    Select * from tbl1
    dataAdapter.Fil l(dataset1, "tbl1")

    dataview1 = dataset1.Tables ("tbl1")
    dataview1.sort = "FirstName"
    datagridview1.d atasource= dataview1

    how can I force datagridview1 to display all date values with 4 digit years?

    Thanks,
    Rich
  • =?Utf-8?B?UmljaA==?=

    #2
    RE: datagridview displays 4 digit yrs on cmptr1 and 2 digit yrs on cmp

    Incase anyone cares - here is how to force a date format in the datagridview

    datagridview1.C olumns("date1") .DefaultCellSty le.Format = "MM/dd/yyyy"


    Note: I believe that the month portion needs to be upper case M's for
    VS2005 to recognize it as a Month param.


    "Rich" wrote:
    Using VB2005, a datagridview is displaying the dates with 4 digit years on
    one workstation but displays the dates of the exact same records with only 2
    digit years on a 2nd workstation. I will guess that it may be an environment
    setting on the other workstation. But how can I make the datagridview
    display the dates in the same format consistently for all workstations?
    >
    The data is coming from a sql Server 2000 table.
    >
    Select * from tbl1
    dataAdapter.Fil l(dataset1, "tbl1")
    >
    dataview1 = dataset1.Tables ("tbl1")
    dataview1.sort = "FirstName"
    datagridview1.d atasource= dataview1
    >
    how can I force datagridview1 to display all date values with 4 digit years?
    >
    Thanks,
    Rich

    Comment

    • Cor Ligthert[MVP]

      #3
      Re: datagridview displays 4 digit yrs on cmptr1 and 2 digit yrs on cmp

      Rich,
      >
      Note: I believe that the month portion needs to be upper case M's for
      VS2005 to recognize it as a Month param.
      As is for years standard, because lower case mm stands for minutes.

      Cor

      Comment

      Working...