4 Replies - 167 Views - Last Post: 26 October 2018 - 12:05 PM Rate Topic: -----

#1 M3t3xu   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 21-October 18

VB.NET System.DivideByZeroException

Posted 26 October 2018 - 10:58 AM

Hi! Im in real trouble...
I have this code:
        With ProgressBar1
            .MaximumValue = CInt(Player.currentMedia.duration)
            .Value = CInt(Player.controls.currentPosition)
        End With


and its giving me this error:
System.DivideByZeroException



Im made player (Windows Media Player - Interop.WMPLib) and I want to synchronize the progressbar with it.

Can you help me?
(Its my first post so sorry for any mistakes)

Is This A Good Question/Topic? 0
  • +

Replies To: VB.NET System.DivideByZeroException

#2 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14593
  • View blog
  • Posts: 58,462
  • Joined: 12-June 08

Re: VB.NET System.DivideByZeroException

Posted 26 October 2018 - 11:10 AM

Put a break point on that line. Hover your mouse over that line and see what those values are.

Also: turn these two on.
Tools -> options -> projects and solutions -> vb defaults.. make sure 'option explicit' and 'option strict' are on.
Was This Post Helpful? 0
  • +
  • -

#3 M3t3xu   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 21-October 18

Re: VB.NET System.DivideByZeroException

Posted 26 October 2018 - 11:41 AM

View Postmodi123_1, on 26 October 2018 - 11:10 AM, said:

Put a break point on that line. Hover your mouse over that line and see what those values are.

Also: turn these two on.
Tools -> options -> projects and solutions -> vb defaults.. make sure 'option explicit' and 'option strict' are on.


Ok. I made what you have told and Player.currentMedia.duration = 0.
And now what?
Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is online

  • Suitor #2
  • member icon



Reputation: 14593
  • View blog
  • Posts: 58,462
  • Joined: 12-June 08

Re: VB.NET System.DivideByZeroException

Posted 26 October 2018 - 11:54 AM

What about the other one?
Was This Post Helpful? 0
  • +
  • -

#5 M3t3xu   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 21-October 18

Re: VB.NET System.DivideByZeroException

Posted 26 October 2018 - 12:05 PM

Ok. I found where I've made a mistake. It was the load timer.
But thank you very much for your help.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1