Skip to main content

Another Timer Demo

What this done is simple.

When I click on a Button the progress bar will show for 5 seconds and then some other work can be done. Well, here it is.

'Simple Timer demo by Sarthak Ganguly
'Released under GPLv3 Share Alike License.
 
Public Class MainFrm
    'Say 2 seconds is the default timeout
    'You can change it from here or make it a
    'property with Get and Set statements
    'you can increase it to 3,4,5... seconds
    Dim timeLimit As Integer = 50 * 100 '(milliseconds)
    Dim temp As Integer = 0
    Private Sub clickBUT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles clickBUT.Click
        'Start the timer
        aTmr.Enabled = True
    End Sub
    Private Sub aTmr_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) _
        Handles aTmr.Tick
        'The timer ticks :) with Step 100ms
        progBar.Value += OneStep()
        'Stop the Timer
        temp += 100
        If temp = timeLimit Then
            aTmr.Enabled = False
            temp = 0
            'Add code if you want anything to happen after progressbar
            'reaches maximum value
        End If
    End Sub
    'This is the most important function as it will return the
    'relative unit size of the progress bar
    Private Function OneStep() As Integer
        'One unit returned and converted to nearest Integer
        Return CInt(progBar.Maximum / (timeLimit / 100))
    End Function
End Class

Popular posts from this blog

Burhan Wani – The man and his mission

Burhan Wani – The man and his mission The death of a young ‘hero’? On the 8th of July, Burhan Muzaffar Wani died in the Valley of Kashmir. Thousands poured out on the streets to commemorate his services to the movement that he had come to symbolize of late. The relative calm of the region was shattered with curfews, killings and allegations of human rights abuses. His father was proud for the services his son had offered in the name of their faith, convinced that he would go to Heaven. Amidst all this, the romantic ideals of a young boy, just off his teens began to shake up the youth of the entire country, both in and beyond India. There is a lot of unrest in the Kashmir Valley recently, especially in the aftermath of the death, nay execution of Burhan. All of this is not unexpected in any way. In fact, this was foreseen. Even his glorification, his elevation to the status of a martyr in the service of Islam does not come as a surprise to me.
There is a section of the media and a sig…

Indian Partition - The Forgotten Question

The Partition of India was a terrible catastrophe. There is no doubt about that. Millions were killed, displaced, thousands were raped, orphaned etc. All this was done in a space of a few months. Mobs frantically killed each other for life, religion, property, identity, revenge and any other reason they could then think of. Even since the call for Direct Action, there was no doubt about a serious religious conflict. What followed was an eventual ethnic cleansing of parts of India of non Muslims and Muslims. How it happened, what happened, how trains full of dead bodies piled up on each side of new borders is well known. Hundreds of books have been written, research over decades have been published. We know all that.

The basic idea of it all was simple - Jinnah believed Hindus and Muslims are two separate nations and the latter should have a distinct political entity for themselves, based on Islam, their faith. To identify this they had to prove one thing. That the All India Muslim Le…

The postman, Megha and I

This is a story that goes way back to 2001 or 2002. I was in the sixth standard. Yes, I do remember it quite vividly. It was funny, painful and a bit out of the ordinary – basically it had all the ingredients that allows a memory to stick a great while longer than others. In the process of my recollection, I may miss out a few pieces here and there, but it will be pretty accurate. Of course, the intention of this exercise is in no way to humiliate anyone else or point out the flaws about others’ actions. I now find it hilarious and I think so would you.
I studied in the Vivekananda Mission School, a private English medium school in Joka, on the outskirts of Kolkata. If you know the location of the Indian Institute of Management, Kolkata, you know the location of my school. I studied there till the twelfth standard. We had many students in our class (sixth). We were divided into several sections, ranging from A to F (not sure if it was F or G). But anyway, I was in section B, the sect…