Results 1 to 4 of 4

Thread: display number in time format

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Nov 2006
    Posts
    176

    display number in time format

    Hi All.
    I have parent DGV form and child Detail form. The user enter data in Detail from, for instance, the field AbsenceDays keep number of days like integer. If it possible, how to display in DGV that number in time format HHH:00?
    Example: user will enter 5 in field AbsenceDays but in DGV I would like to display 35:00.
    Thanks.

  2. #2
    Frenzied Member CoachBarker's Avatar
    Join Date
    Aug 2007
    Location
    Central NY State
    Posts
    1,121

    Re: display number in time format

    Maybe I am missing something but why would 35 be equivalent to 5
    Thanks
    CoachBarker

    Code Bank Contribution
    Login/Manage Users/Navigate Records
    VB.Net | C#

    Helpful Links: VB.net Tutorial | C Sharp Tutorial | SQL Basics

  3. #3
    Fanatic Member manhit45's Avatar
    Join Date
    May 2009
    Location
    Ha noi - Viet Nam
    Posts
    826

    Re: display number in time format

    You need to write a fragment code to format it.

    like this:

    Code:
     Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
     Dim The_time as integer       
     Dim mm, ss As Integer
            mm = Int(The_Time / 60)
            ss = The_Time Mod 60
            Time_Label.Text = (Format(mm, "00") & ":" & Format(ss, "00"))
            The_Time += 1
        End Sub
    --***----------***-----

    If i help you please rate me.

    Working with Excel * Working with String * Working with Database * Working with array *

    K51 ĐH BÁCH KHOA HÀ NỘI - Khoa CNTT pro.

  4. #4
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: display number in time format

    Quote Originally Posted by CoachBarker View Post
    Maybe I am missing something but why would 35 be equivalent to 5
    I can only assume that 5 days at 7 hours a day is 35 hours. Of course, it would be nice if people were to explain things in the first place so we didn't have to assume. If that is the case then it would simply be:
    vb.net Code:
    1. Dim days = 5
    2. Dim hours = days * 7
    3.  
    4. MessageBox.Show(hours.ToString("0':00'"))
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

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