Results 1 to 7 of 7

Thread: [RESOLVED] how to make an image display and disappear after 3 seconds with no timer

  1. #1

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Resolved [RESOLVED] how to make an image display and disappear after 3 seconds with no timer

    hey,
    is there a way to make a image display for 3 seconds and then disappear
    without using any timer?
    regards
    salsa

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: how to make an image display and disappear after 3 seconds with no timer

    Sure, count to 3 and close your app

    Without a timer, you would likely cache the VB Timer function value, enter a DoEvents loop and test the VB timer function until 3 seconds have elapsed. The VB Timer() function is not a VB timer control. When 3 seconds elapse, hide your image.

    Can you tell us why you don't want to use a timer control?
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: how to make an image display and disappear after 3 seconds with no timer

    i dont like timers
    can you show me sir a sample code with and with out a timer?

  4. #4
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: how to make an image display and disappear after 3 seconds with no timer

    Not recommended - I don't like DoEvents loop unless absolutely needed
    Code:
        Dim sngTimer As Single
        ' -- show your image
        sngTimer = Timer
        Do Until Timer - sngTimer > 3 Or Timer < sngTimer
            DoEvents
        Loop
        ' -- hide your image
    Your CPU usage may spike during this timeframe. If it does, you'll want to consider adding a call to the Sleep API. For examples, do a quick search for these terms: DoEvents Sleep

    A timer control is easy
    1. Add a timer control to your form. Set its Enabled property to: False
    2. Show your image and set the timer interval and enabled properties...
    Timer1.Interval = 3000: Timer1.Enabled = True
    3. In the Timer1_Timer() event...
    Timer1.Enabled = False ' then hide your image
    4. Done

    Note: Timer control Interval property is 1000ths of a second, so 3000 = 3 seconds
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  5. #5

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: how to make an image display and disappear after 3 seconds with no timer

    hey sir tnk you
    but now i have another issue
    i have a listview in the form
    when i want to display the control,the listview is hiding it why?
    Name:  Untitled.jpg
Views: 319
Size:  36.3 KB

  6. #6
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: how to make an image display and disappear after 3 seconds with no timer

    Because of ZOrder.

    This is how you bring something to the front or send it to the back, in code:
    When you show the control, set it's ZOrder: Command1.ZOrder vbBringToFront
    That will bring it to the front.
    If you want to send any control to the back: ControlName.ZOrder vbSendToBack

    You can also set your control above the listview in design view. Click on the command button and click the menu items: Format | Order. You'll have options to send to back or bring to front, along with the shortcut keys for doing the same thing in design view. You can also right click on a control and choose the option from the context menu.
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  7. #7

    Thread Starter
    Enjoy the moment
    Join Date
    Feb 2011
    Location
    Barrio Del pilar madrid spain
    Posts
    5,204

    Re: how to make an image display and disappear after 3 seconds with no timer

    thank you sirrrrrrrrrrrrr

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