Results 1 to 3 of 3

Thread: DataGridView format to short time

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2006
    Posts
    176

    DataGridView format to short time

    Hi All.
    My stored procedure covert two integer column Hours and Minutes to varchar data type and after concatenation the result looks like HH:MM (1:05).
    In DGV form I have problem to display same values. The EmpTime column is dispay time like (1:5). The column's coding is:
    Me.DataGridView.Columns("EmpTime").DefaultCellStyle.Format = "HH:mm".
    How to fix that problem.
    Thanks.

  2. #2
    Lively Member
    Join Date
    Oct 2008
    Posts
    87

    Re: DataGridView format to short time

    Me.DataGridView.Columns("EmpTime").DefaultCellStyle.Format = "t"

    for more see: http://msdn.microsoft.com/en-us/library/97x6twsz.aspx

  3. #3
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: DataGridView format to short time

    You convert 2 integer fields to a varchar field... Since varchar is string type, the formatting won't work. However, the datagridview will display it "as is". You need to double check the conversion perfromed by your stored procedure and make sure that it produces the correct result. It may not be hwat you think it is.
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width