View Single Post
 
Old 07-26-2014, 02:48 PM
xcpcx24 xcpcx24 is offline
Newcomer
 
Join Date: Jul 2014
Posts: 3
Default VB 2012 Progress Bar to Track remaining time

I am really new to programming ( i like it a lot) I am creating a program that basically compares two times. (similar to an alarm) once the time is up it will pop out a message indicating that time is up!!! In addition I would like to integrate a progressbar that would load based on the the remaining time before the time is up. I am stock at the progress bar I am not sure what to do or where to go from here. Can any one provide me with some suggestions/guidance or a code i can take a look at for reference?

My code:
Code:
 Imports System.Net.Mime.MediaTypeNames

Public Class Form1
    Private hour As Integer = 0
    Private minute As Integer = 0
    Private second As Integer = 0

    Public Sub show_time()
        second += 1
        If second = 59 Then
            second = 0
            minute += 1
            If minute = 59 Then
                minute += 1
                hour += 1
            End If
        End If

        Label3PrgressStdPC.Text = hour.ToString.PadLeft(2, "0") & ":"
        Label3PrgressStdPC.Text &= minute.ToString.PadLeft(2, "0") & ":"
        Label3PrgressStdPC.Text &= second.ToString.PadLeft(2, "0")
        Label3PrgressStdPC.Refresh()

    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        show_time()
        If TextBox1.SelectedText = TextBox1.Text Then Exit Sub
        If TextBox1.Text = Label3PrgressStdPC.Text Then
            Timer1.Stop()
            MsgBox("time is up")
            
        End If
    End Sub

    Private Sub Bn_start_St01_Click(sender As Object, e As EventArgs) Handles Bn_start_St01.Click
        Timer1.Start()
        Timer1.Enabled = True
        ProgressBar1.Minimum = 0
        ProgressBar1.Maximum = Val(TextBox1.Text) * 60
        ProgressBar1.Value = 0
        Timer2.Start()
        Timer2.Enabled = True

    End Sub

   

    Private Sub ProgressBar1_Click(sender As Object, e As EventArgs) Handles ProgressBar1.Click
        ProgressBar1.Maximum = Val(TextBox1.SelectedText)
        ProgressBar1.Minimum = 0

    End Sub

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        ProgressBar1.Maximum = Val(TextBox1.Text)
        ProgressBar1.Maximum = 0
    End Sub

    Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
        ProgressBar1.Value = ProgressBar1.Value +1'  I dont know what to do from here i need help
 



    End Sub
End Class
_________________________________________________________________


Thank you

Last edited by passel; 07-29-2014 at 07:47 AM. Reason: Added [code][/code] tags
Reply With Quote