a friend of mine is making a media player for her final project and is using the same code i am with some little differences and is having problems with the line
VB Code:
  1. Then dblTrackPosition = mciMidi.position / mciMidi.Length

her code is pretty much the same so i dont know why its not working heres the whole code so you know whats going on

VB Code:
  1. Option Explicit
  2. Dim strFileName As String
  3. Dim dblTrackPosition As Double
  4. Dim intRed As Integer
  5. Dim intGreen As Integer
  6. Dim intBlue As Integer
  7.  
  8. Private Sub form_load()
  9.     'Open the midi player
  10.     mciMidi.Command = "Open"
  11. 'Colors
  12. hsbRed.Value = 228
  13. hsbGreen.Value = 147
  14. hsbBlue.Value = 136
  15. OptStyle(0).Value = True
  16. OptShape(0).Value = True
  17. End Sub
  18.    
  19. Private Sub Form_Unload(Cancel As Integer)
  20.     'Close midi player
  21.     mciMidi.Command = "Close"
  22. End Sub
  23.  
  24. Private Sub mciMidi_StatusUpdate()
  25.     'Display the status
  26.     If mciMidi.Mode = mciModeNotOpen Then
  27.         txtStatus.Text = "Not ready"
  28.     ElseIf mciMidi.Mode = mciModeStop Then
  29.         txtStatus.Text = "Stopped"
  30.     ElseIf mciMidi.Mode = mciModePlay Then
  31.         txtStatus.Text = "Play"
  32.     ElseIf mciMidi.Mode = mciModeRecord Then
  33.         txtStatus.Text = "Record"
  34.     ElseIf mciMidi.Mode = mciModePause Then
  35.         txtStatus.Text = "Pause"
  36.     ElseIf mciMidi.Mode = mciModeReady Then
  37.         txtStatus.Text = "Ready"
  38.     End If
  39.    
  40.     'Display the filename being played
  41.     txtFileName.Text = mciMidi.FileName
  42.    
  43.     'If no file is selected; do not calculate
  44.     '    the slide position
  45.     If Not strFileName = "" Then dblTrackPosition = mciMidi.position / mciMidi.Length
  46.     'Caluculate the slider position
  47.     Slider1.Value = dblTrackPosition * 1000
  48.     If dblTrackPosition = 1 Then
  49.         Slider1.Value = 0
  50.         mciMidi.Command = ""
  51.     End If
  52.  
  53. End Sub
  54.  
  55. Private Sub mnuFileOpen_Click()
  56.  
  57. On Error GoTo Errhandler
  58.  
  59.     mciMidi.Command = "Stop"
  60.     mciMidi.DeviceType = "sequencer"
  61.     cdlFile.Filter = "All Files (*.*) |*.*|Wave Files (*.wav)|*.wav|Midi Files(*.mid)|*.mid|MP3 Files(*.mp3)|*.mp3|Windows Media Files(*.wmv)|*.wmv|Avi Files(*.avi)|*.avi|Windows Media Audio Files(*.wma)|*.wma|"
  62.     cdlFile.ShowOpen 'Display dialog box
  63.     strFileName = cdlFile.FileName  'Select file name
  64.     mciMidi.FileName = strFileName
  65.     mciMidi.Command = "Open"
  66.     mciMidi.UpdateInterval = 100
  67.  
  68.     Exit Sub
  69. Errhandler:
  70.     MsgBox Err.Number & "|" & Err.Description
  71. End Sub
  72.  
  73.  
  74. Private Sub hsbBlue_Change()
  75.   intBlue = hsbBlue.Value
  76.     Shape1.FillColor = RGB(intRed, intGreen, intBlue)
  77.     lblBlue.Caption = "Blue:" & CStr(intBlue)
  78. End Sub
  79.  
  80.  
  81. Private Sub hsbGreen_Change()
  82.   intGreen = hsbGreen.Value
  83.     Shape1.FillColor = RGB(intRed, intGreen, intBlue)
  84.     lblgreen.Caption = "Green:" & CStr(intGreen)
  85. End Sub
  86.  
  87. Private Sub hsbRed_Change()
  88.   intRed = hsbRed.Value
  89.     Shape1.FillColor = RGB(intRed, intGreen, intBlue)
  90.     lblRed.Caption = "Red:" & CStr(intRed)
  91. End Sub
  92.  
  93. Private Sub OptShape_Click(Index As Integer)
  94.     Select Case Index
  95.         Case 0 'The Rectangle
  96.             Shape1.Shape = 0
  97.         Case 1 'The Square
  98.             Shape1.Shape = 1
  99.         Case 2 'The Oval
  100.             Shape1.Shape = 2
  101.         Case 3 'The Circle
  102.             Shape1.Shape = 3
  103.         Case 4 'The Rounded Rectangle
  104.             Shape1.Shape = 4
  105.         Case 5 'The Rounded Square
  106.             Shape1.Shape = 5
  107.     End Select
  108.    
  109. End Sub
  110.  
  111. Private Sub OptStyle_Click(Index As Integer)
  112.    Select Case Index
  113.         Case 0 'The Solid FillStyle
  114.             Shape1.FillStyle = 0
  115.         Case 1 'The Transparent FillStyle
  116.             Shape1.FillStyle = 1
  117.         Case 2 'The Horizontal Line FillStyle
  118.             Shape1.FillStyle = 2
  119.         Case 3 'The Vertical Line FillStyle
  120.             Shape1.FillStyle = 3
  121.         Case 4 'The Upward Diagonal Line FillStyle
  122.             Shape1.FillStyle = 4
  123.         Case 5 'The Downward Diagonal FillStyle
  124.             Shape1.FillStyle = 5
  125.         Case 6 'The Cross FillStyle
  126.             Shape1.FillStyle = 6
  127.         Case 7 'The Diagonal Cross FillStyle
  128.             Shape1.FillStyle = 7
  129.            
  130.             End Select
  131.        
  132.         End Sub