Click here to Skip to main content
15,906,268 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I am making a media player software using vb.net

I have taken a progress bar to increase or decrease a volume.I am not not able to write exact code for it.
I want that when I click progress bar volume should increse or decrease depends upon user requirements as we see in media player like vlc or window media player.

i tried following code

VB
Private Sub ProgressBar1_Click_2(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProgressBar1.Click
       ProgressBar1.PerformStep()
       wmp.settings.volume = ProgressBar1.Value
       If ProgressBar1.Value = 100 Then
           ProgressBar1.Value = 40
       End If

   End Sub

please help me regarding this
Posted

This is the answer to a follow-up question following the advice by John:

Handle the event System.Windows.Forms.TrackBar.ValueChanged (not Click); use the event arguments parameter passed to your event handle to access the sender and read the value of its int property System.Windows.Forms.TrackBar.Value; let's say it's assigned to the variable value. Assign: wmp.settings.volume = value, in the body of this event handler.

See: http://msdn.microsoft.com/en-us/library/system.windows.forms.trackbar.aspx[^].

—SA
 
Share this answer
 
v2
Why don't you the a TrackBar control instead? With a progress bar, you have no way to turn the volume *down*.
 
Share this answer
 
Comments
shivani 2013 6-Jul-11 8:23am    
what will be the coding for it
Sergey Alexandrovich Kryukov 6-Jul-11 11:48am    
OK, I answered; please see my solution. Why would not you simply look at MSDN page instead? http://msdn.microsoft.com/en-us/library/system.windows.forms.trackbar.aspx
--SA
#realJSOP 6-Jul-11 12:58pm    
The coding for it is "google is your friend". Learn it. Live it.
Sergey Alexandrovich Kryukov 6-Jul-11 11:40am    
Exactly, a 5.
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900