Results 1 to 2 of 2

Thread: How To Show Image For 10 Second Period Then Will Be Null After That ?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2018

    How To Show Image For 10 Second Period Then Will Be Null After That ?


    How to show image for 10 second period then will be null After that ?

    I have TimerCount on windows form get last image on table members every second

    and this is work success using windows form timer on visual studio 2017 .

    and I need when new image retrieved show this image for 10 second then make it null


    After that will be null in case of not new image retrieved

    and within 10 second if new image retrieved by TimerCount not wait for ten second

    show image per 10 second only if no image retrieved within ten second

    and if after 10 second no image retrieved set image to null ?

    pseudo code
    if(new image retrieved )
    show it per 10 second
    if(after 10 second no image retrived)
    if(new image retrieved by timercount)
    not wait until 10 second display for current image
    can you help me or give me idea for that please ?

    What I have tried:

    private void TimerCount_Tick(object sender, EventArgs e)
    public void GetMembersData()
                string sqlGetLast = @"select isnull((select top 1 MemberCode from members order by MemberCode desc),1) ";
                 MemberCode = Utilities.ObjectConverter.ConvertToInteger(DataAccess.ExecuteScalar(sqlGetLast));
                string sqlImage = "select MemberImage FROM Members WHERE MemberCode =" + MemberCode + "";
                if (Utilities.ObjectConverter.ConvertToString(DataAccess.ExecuteScalar(sqlImage)) != "")
                    byte[] MemberImage = (byte[])DataAccess.ExecuteScalar(sqlImage);
                    Gate1Pic.Image = ByteArrayToImagebyMemoryStream(MemberImage);

  2. #2
    Sinecure devotee
    Join Date
    Aug 2013
    Southern Tier NY

    Re: How To Show Image For 10 Second Period Then Will Be Null After That ?

    If I understand the situation, I do something along that line with what I call a Watchdog counter.

    You create an integer variable to act as a watchdog counter.
    In the timer, each tick (one second interval) you:

    decrement the counter.

    You check for a picture, and if you have one, you show it and set the counter to 10.

    You check the value of the counter and if it is 0, you null the picture.

    So, as long as you get a picture within the 10 second window, you show it and reset the counter to 10.
    If you don't have a picture in 10 seconds, the counter will reach 0 and you'll null the picture.

Tags for this Thread

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