KEMBAR78
Colered Progressbar VB Code | PDF
0% found this document useful (0 votes)
37 views1 page

Colered Progressbar VB Code

The document contains a Visual Basic .NET code for a Windows Forms application that changes the color of a progress bar based on button clicks. It defines an enumeration for color options and uses the SendMessage function to update the progress bar's color. The application includes three buttons to set the progress bar to red, green, or yellow, and a timer to increment the progress bar's value.

Uploaded by

jetspyderhd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
37 views1 page

Colered Progressbar VB Code

The document contains a Visual Basic .NET code for a Windows Forms application that changes the color of a progress bar based on button clicks. It defines an enumeration for color options and uses the SendMessage function to update the progress bar's color. The application includes three buttons to set the progress bar to red, green, or yellow, and a timer to increment the progress bar's value.

Uploaded by

jetspyderhd
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

Public Class Form1

Declare Auto Function SendMessage Lib "user32.dll" (ByVal hWnd As IntPtr, ByVal
msg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
Enum ProgressBarColor
Green = &H1
Red = &H2
Yellow = &H3
End Enum
Private Shared Sub ChangeProgBarColor(ByVal ProgressBar_Name As
Windows.Forms.ProgressBar, ByVal ProgressBar_Color As ProgressBarColor)
SendMessage(ProgressBar_Name.Handle, &H410, ProgressBar_Color, 0)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
ChangeProgBarColor(ProgressBar1, ProgressBarColor.Red)
Timer1.Start()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
ProgressBar1.Value = 0
ChangeProgBarColor(ProgressBar1, ProgressBarColor.Green)
Timer1.Start()
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
ProgressBar1.Value = 0
ChangeProgBarColor(ProgressBar1, ProgressBarColor.Yellow)
Timer1.Start()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Timer1.Tick
ProgressBar1.Value += 1
End Sub
End Class

You might also like