Sabtu, 05 April 2014

Membuat Form Progress Bar

Sedikit mundur ke belakang kali ini saya akan membahas tentang pembuatan form progress bar yang simple tapi enak buat dilihat.



langsung saja ke source code  untuk membuat progress bar ini :




Public Class PROGRESSBAR
    Dim tulisan(2) As String
    Dim i, j As Integer
    Dim processName As String

 '----------source code untuk timer1-----------------
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If ProgressBar1.Value < 100 Then
            ProgressBar1.Value += 2
        ElseIf ProgressBar1.Value = 100 Then
            Timer1.Stop()
            Me.Hide()
            frlogin.Show()
        End If
    End Sub

'--------------------source code untuk form load---------
    Private Sub PROGRESSBAR_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        tulisan(0) = " .........."
        tulisan(1) = " .........."
        tulisan(2) = " .........."
        lb_loading.Text = tulisan(j)
        Timer1.Start()
        Timer2.Start()
        Timer1.Start()
        Dim compname As String = My.Computer.Name
        Dim compuser As String = SystemInformation.UserName
        lb_comname.Text = compname
        lb_comuser.Text = compuser
    End Sub


'----------source code untuk timer2-----------------
    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        If i.Equals(tulisan(j).Length) Then
            Me.lb_loading.Text = ""
            If j < tulisan.Length - 1 Then
                j = j + 1
                Me.lb_loading.Text = tulisan(j)
            Else
                j = 0
            End If
            i = 0
        End If
        lb_loading.Text = tulisan(j).Substring(0, i)
        i = i + 1
    End Sub

  '----------source code untuk button 1 atau jika dilihat dari form, source code ini dipasang untuk button next-----------------  
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Hide()
        frlogin.Show()
    End Sub
 

===selamat mencoba, jika terdapat error atau ada yang tidak mengerti silahkan tinggalkan komentar, terimakasih=====



0 komentar:

Posting Komentar