回 帖 发 新 帖 刷新版面

主题:有谁有空帮我改一下这些功能代码吗?

'循环播放功能代码
        Try
            If AxWindowsMediaPlayer1.status = "已停止" Then
                Try
                    If AxWindowsMediaPlayer1.fullScreen = True Then
                        AxWindowsMediaPlayer1.fullScreen = False
                    End If
                Catch ex As Exception
                End Try
                '//播放条件判断
                If filelist.Count > intcount + 1 Then
                    AxWindowsMediaPlayer1.URL = filelist.Item(intcount + 1)
                    intcount = intcount + 1
                    ListView1.SetSelected(intcount, True)
                    Timer2.Enabled = True
                    Exit Sub
                End If
                intcount = intcount + 1
                '//循环条件判断
                If intcount = ListView1.Items.Count Then
                    intcount = 0
                    '//使其被选中
                    AxWindowsMediaPlayer1.URL = filelist.Item(intcount)
                    ListView1.SetSelected(intcount, True)
                    Timer2.Enabled = True
                End If
            End If
        Catch ex As Exception
            Try
                AxWindowsMediaPlayer1.URL = filelist.Item(0)
                intcount = 0
            Catch 'ex As Exception
                'Timer3.Enabled = False
                Timer3.Enabled = False
            End Try
        End Try

一运行就提示ListView1.SetSelected(intcount, True)这一行有错,我也知道这行错了,但是不会改!恳请会的同志帮帮手,在此先谢了!

回复列表 (共1个回复)

沙发

If filelist.Count > intcount + 1 Then
                    AxWindowsMediaPlayer1.URL = filelist.Item(intcount + 1)
                    intcount = intcount + 1
                    ListView1.SetSelected(intcount, True)
在这几句加入断点,然后查看filelist.Count的值和ListView1.SetSelected(intcount, True)中intcount的值
列表框中只有Count个文件的话,是无法给Count+1位置的项目select成true的

我来回复

您尚未登录,请登录后再回复。点此登录或注册