How do i set a slider's value to a max that corresponds to the end of a movie file? Also how do i set the volume on a slider?
Printable View
How do i set a slider's value to a max that corresponds to the end of a movie file? Also how do i set the volume on a slider?
Try this for volume:
[code]
Private Sub Slider1_Change()
MediaPlayer1.Volume = Slider1.Value
End Sub
Private Sub Slider1_Scroll()
MediaPlayer1.Volume = Slider1.Value
End Sub
[/code[
Set max of slider to 100 (If u using a vertical slider, set to -100, and use the ABS function - "MediaPlayer1.Volume = ABS(Slider1.Value)")
Set the min of slider to 0 (If u using a vertical slider, set to 0)
What's the ABS function?
it stops your car without locking the wheels ;) :D
Actually, it's this...Quote:
Returns a value of the same type that is passed to it specifying the absolute value of a number.
Syntax
Abs(number)
The required number argument can be any validnumeric expression. If number contains Null, Null is returned; if it is an uninitialized variable, zero is returned.
Remarks
The absolute value of a number is its unsigned magnitude. For example, ABS(-1) and ABS(1) both return 1.
ExampleVB Code:
Dim MyNumber MyNumber = Abs(50.3) ' Returns 50.3. MyNumber = Abs(-50.3) ' Returns 50.3.
So where should i be putting it? Also does nayone know anything about setting the max for a position slider because if i set to just like 100 it only goes like 2 minutes into the movie?
ABS function returns the absolute value of a number.
for xample:
Number=-85
if u call the ABS function:
ABS(Number)
the return value is 85
BUT if u Number=85 and u call the ABS function, the return value will b 85 again. (and not the oposite, -85)
U need to put the ABS funstion ONLY if u using a vertical slider, just like i xplained
maybe it's in minutes?Quote:
Originally posted by stickman373
set to just like 100 it only goes like 2 minutes into the movie?
So this should be the code:
Because i use this and when i change the scroll it gives me a mediaplayer error?Code:Private Sub Slider2_Change()
MediaPlayer1.Volume = Abs(Slider2.Value)
End Sub
Private Sub Slider2_Scroll()
MediaPlayer1.Volume = Abs(Slider2.Value)
End Sub
Also Chrisjk i only got a few seconds when i had it at 100 as a max. Anyways there has to be a way to get a exact value it should be set at otherwise there is blank space at the end if i set it to a lareg number like 5000. Every movie is different!
:confused:
Sory man, but i'm completly sure about the code i gave u...neway, what's the error?
***??? nm, i'll type slower:Quote:
Sory man, but i'm completly sure about the code i gave u...neway, what's the error?
Sorry man, but i'm NOT completly sure about the code i gave u here, what's the error?
runtime error -2247352567 (80020009)
Methosd 'Volume' of object 'IMediaplayer2' failed
that's the error whe i go to change the slider?
Do u get this error when u using the Change sub, the Scroll sub, or both??
scroll sub gives the error.:confused:
Sorry, i can't figure out what's the prob....:(
:( :( :( Darn!
does this slider control i gave you work with that code?
HI I had the same problem that stickman373 with the Media Player's error.
Stiletto said to use the volume's property but I get the next error tring to set positive values, so I tried with the opposite values and found that the maximun volume is getting whit 0 and the minimum volume with the -2300 aprox.
So the range of values are between 0 (maximun volume) and -2300 (minimun volume).
But I don't remember if some of this values (negatives) cause error cause I used the instruction On Error Resume Next to provide break the application with positive values.
So here's the code
private sub Command1_Click()
On error Resume Next
MediaPlayer1.Volume=Text1.text
End Sub
I'm working with a value located in a TextBox
So you performance this code without the Instruction On error Resume next, but remember the range of values
I don't know if Stiletto have Windows 98 or any different version of Media Player provided in Windows 95 (sorry I can't check the version cause I isn't in my computer) but I hope the code work good at all version even in Media Player 7
Ok that's all.