C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » VB.NET Syntax »

Dealing with timer


Posted Date: 02 Oct 2009    Resource Type: Code Snippets    Category: VB.NET Syntax
Author: NeetuMember Level: Diamond    
Rating: 1 out of 5Points: 7



Form opacity and timer.

Example1



In this first form wil be transparent and at the end of timer. Form look wil be changed.



Public Class Form2
Dim i As Integer
Private Sub Form2_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
i = 5
End Sub
Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick
If i > 255 Then
i = 0
Else
Me.BackColor = Color.FromArgb(i, i, i)
i = i + 10
End If
If i = 255 Then
Me.Opacity = 100%
Me.BackColor = Color.FromArgb(i, i, i)
Timer1.Enabled = False
End If
End Sub
End Class



Example2



Timer and processing bar.



Public Class Form3
Dim i As Integer
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
PB1.Maximum = 100
PB1.Minimum = 0
'PB1.Step = 10
'PB1.Increment(10)
i = 0
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
PB1.Value = i
If i = 10 Then
Label1.Text = "Wait" & i & "%"
ElseIf i = 30 Then
Label1.Text = "Checking for the connection" & i & "%"
ElseIf i = 50 Then
Label1.Text = "Connecting with the database" & i & "%"
Else
Label1.Text = "Going to complete" & i & "%"
End If
i = i + 10
If i = 100 Then
PB1.Value = 100
Timer1.Enabled = False
Label1.Text = "Completed Processing continue ur work"
Dim F As New Timerex2
Me.Visible = False
F.Show()
End If
End Sub

Private Sub PB1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PB1.Click

End Sub

Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click

End Sub
End Class


regards
Neetu



Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Sign In to add tags.
Timer handling  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: CPU Monitor
Previous Resource: MDI and child Form
Return to Discussion Resource Index
Post New Resource
Category: VB.NET Syntax


Post resources and earn money!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use