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…

Letters, open and counters

In this Information age, the opinions of people are shaped by the discourse that happens in the media – the newspapers, the internet forums, the videos that are shot, the letters, open letters and counter letters. A vast majority of them are full of half-truths and that is not surprising as every side has skeletons to hide. The problem arises when a gullible population (read Indians) digest these printed words both offline and on as the ultimate Truth without question. Secondary sources and even imaginary accounts becomes Gospels to be used to shut anyone who dares to oppose the mainstream discourse.
The Quint has recently published an open letter by a veteran soldier of the Indian Army named Major Gaurav. They apparently waited for a counter to that which was furnished by a Wasim Khan, a ‘Kashmiri’ who now is settled in Mumbai and runs a successful media agency (not surprising). So before we go into braindead blaming attempts, let’s analyze the two pieces one by one and check the m…

The Man and the Qu'ran in Bangalore

I stayed for 3 years in Bangalore. There were places I loved in the city, places that I liked and a few places that I hated. There were also places about which I cannot make up any opinion at all.

Among them was the Jumma Masjid on the Dispensary road. This is not to be confused with the more famous Trust by the same name that is close by.

The area around is always busy and the commercial street is also close. The markets were always full of customers, shopkeepers sold exotic items. Just a few hundred meters and you could also visit the markets selling lots of stolen goods, though the shopkeepers often deny that and then wink to show that they were bluffing. It is a fun place for a man to be in, a bit scary for many women, except in a crowd.

Anyway, I always found the place inviting in a peculiar way, the nearby Salafi mosque preaching the evils of other religions, the stench of the urinals, the cheap stolen goods in the market, the prostitutes on the road, the hustle and bustle of t…