VB.NET: How do i make a Digital Clock?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • novuseden
    New Member
    • Sep 2007
    • 3

    VB.NET: How do i make a Digital Clock?

    i need to make a digital clock for my computer class that looks like this



    plz help
  • Killer42
    Recognized Expert Expert
    • Oct 2006
    • 8429

    #2
    The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

    Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

    Then when you are ready post a new question in this thread.

    MODERATOR

    Comment

    • novuseden
      New Member
      • Sep 2007
      • 3

      #3
      i write the code DateTime.Now() but it gives me the day, month and year along with the hour, minute, second. I only need the hour, minute, and second, do i need to make a Mid Function or something? im a total newb in VB Please help!

      Here is what i got so far:
      [CODE=vbnet]Public Class Form1

      Private Sub Label1_Click(By Val sender As System.Object, ByVal e As System.EventArg s) Handles Label1.Click

      End Sub

      Private Sub Timer1_Tick(ByV al sender As System.Object, ByVal e As System.EventArg s) Handles Timer1.Tick
      Label1.Text = DateTime.Now()
      End Sub
      End Class[/CODE]

      Comment

      • Killer42
        Recognized Expert Expert
        • Oct 2006
        • 8429

        #4
        Originally posted by novuseden
        ... DateTime.Now() ...
        Since I don't recognise the syntax, I'm guessing this must be one of the later (.Net) versions of VB?

        If this was VB6, I'd say to use the Format() function. As for VB.Net, I have no idea. Try searching the online help for information on formatting date and time values.

        Comment

        • novuseden
          New Member
          • Sep 2007
          • 3

          #5
          im using VB 2005, it is required for school

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            Originally posted by novuseden
            im using VB 2005, it is required for school
            Well, like I said. For a simple syntax question like this, you should hit the online help for VB and search for terms like "date", "time" and "format".

            Comment

            • Chill
              New Member
              • Sep 2007
              • 5

              #7
              Code:
              Lbl_time= Format( Time,"HH:MM:SS")
              Use this - Time is a key word which gets instantaneous time of your PC
              Last edited by Killer42; Sep 11 '07, 04:35 AM. Reason: Fixed closing "CODE" tag.

              Comment

              • Killer42
                Recognized Expert Expert
                • Oct 2006
                • 8429

                #8
                Originally posted by Chill
                Lbl_time= Format( Time,"HH:MM:SS" )
                Will this work in VB 2005? It looks like VB6 code to me.

                Comment

                • hariharanmca
                  Top Contributor
                  • Dec 2006
                  • 1977

                  #9
                  VB 6.0 is an earlier of VB.NET and VB 2005. All the basic methods of VB 6.0 will work in VB.NET and VB 2005.
                  So, we can give solution in VB 6.0 and point them this code is VB 6.0. That will be more helpful to them.

                  Comment

                  • sgrec7
                    New Member
                    • Aug 2007
                    • 58

                    #10
                    Originally posted by Killer42
                    Will this work in VB 2005? It looks like VB6 code to me.
                    Bl***y hell Killer !!! But you are a mod!!! Reading through this and seeing untagged code just slip through the system like that... I dunno some times I think maybe me and you should swap roles ! :P no but seriously, there was some mean Admin that kept on PMing me about the code thing so just make sure that they don't get a VERY STERN and SCARY lecture like I had

                    And I know it had nothing DIRECTLY to do with the thread but ... :P

                    Keep up the good work killer

                    sgrec7

                    Comment

                    • Ali Rizwan
                      Banned
                      Contributor
                      • Aug 2007
                      • 931

                      #11
                      Originally posted by novuseden
                      i need to make a digital clock for my computer class that looks like this



                      plz help
                      Hello,
                      actually i m searching the threads and found this. So i think i can answer your question.
                      I have attached a file check it its very easy just 5 lines.
                      If you want a beautiful digital clock u ever seen in this forum then i ll made up for you.And i can do.
                      Attached Files

                      Comment

                      Working...