Results 1 to 5 of 5

Thread: how do u convert this VB code to VB.net

  1. #1

    Thread Starter
    Member
    Join Date
    Jul 2001
    Posts
    41

    how do u convert this VB code to VB.net

    Public Timer_time()

    label1.capion = TIME

    end if


    As everyone told me the above code will show me time every sec

    if i set the timer object to 1000 intervel

    now the problem is that there no caption in .net labels
    so i think captions mean TEXT in .net term
    e.g labels.text = time

    But then TIME is not in VB.net too >.< so how to i set it so i can show the time in the background so that i see the current time every sec and still cont. with my programs

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Yes most caption properties are now text properties. To get the time check out the shared methods of the DateTime type. Something like DateTime.Now.ToString or DateTime.Now.ToShortTimeString there are several ways to display the time in different formats.

  3. #3

    Thread Starter
    Member
    Join Date
    Jul 2001
    Posts
    41
    so if i wanted that time to runs in the background of the .net form
    will that updates every sec ?? or will it just show the time
    at the instance where i call it ??

    cos i have been looking on help posting on forum for over 5 hour now and i'm kind of getting frustrated to get the answers quickly >.<

    Vb.net help sucks in VS.net pro version

  4. #4
    Frenzied Member
    Join Date
    Oct 2002
    Location
    Gammapolis
    Posts
    1,474
    I guess you have to add a timer (Timer1) to your form and set its interval property to 1000, then start it when you need for example in form load event. Then write your code like this:
    VB Code:
    1. Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    2.         Me.Label1.Text = DateTime.Now.ToLongTimeString
    3. End Sub
    'Heading for the automatic overload'
    Marillion, Brave, The Great Escape, 1994

    'How will WE stand the FIRE TOMORROW?'
    Eloy, Silent Cries and Mighty Echoes, The Vision - Burning, 1979

  5. #5

    Thread Starter
    Member
    Join Date
    Jul 2001
    Posts
    41
    Thks alots ^^ u really save my ass searching >.<



    i have been search and looking the help thing in VB.net >.<
    it too complicated, but now i know what to do it very easy ^^

    thks again

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