Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have MultiThread working or atleast the code runs. Is there a way to tell that it is a new thread. I have watched The taskmanager but nothing new shows up. Also any sub that is called be the sub in the newly spawned thread is run in that new thread correct. Stop Laughing, I'm new to multithreading. :p

 

Thanks

 

ZeroEffect

If you can't find it, Build It.

 

There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10

Posted (edited)
If you are spawning multiple threads then you should see them in taskmanager - unless they are very shortlived.

Without seeing any code though it is impossible to say exactly what is going on though...

 

Sorry About that :)

 


'Here is the Call
'This is in a Module

Imports System.Threading

Dim oThread As System.Threading.Thread
oThread = New Thread(AddressOf modPlayListMan.Refresh_PlayListThread)
PlistNumber = 1
oThread.Start()


'Everything else is done here. The DBF is on a server.

Imports Microsoft.Data.Odbc
Module modLoadPList
   Public objDA2 As New OdbcDataAdapter
   Public objDS2 As New Data.DataSet
   Dim intRow, intArgs As Integer
   Dim k As Long

   Public Function Load_CutsDB()
       Dim strCutInfo As String
       Dim strConnect2, strSql As String
       Dim mvarSysProjPath As String = strDriveLetter & ":\Dad\Files\"
       strConnect2 = "Provider=MSDASQL/SQLServer ODBC;Driver={Microsoft Visual FoxPro Driver};" _
         & "SourceType=DBF;SourceDB=" & mvarSysProjPath _
         & ";InternetTimeout=300000;Transact Updates=True"

       strCutInfo = "SELECT CUT, TITLE, LENGTH, LOCATION, STARTTIME, ENDTIME, EXT FROM CUTS.DBF"

       objDA2 = New OdbcDataAdapter(strCutInfo, strConnect2)

   End Function

   Public Function Fill_Search()
       PlayList.Label1.Text = "Please Wait, Playlist Loading"
       PlayList.Refresh()
       objDA2.Fill(objDS2, strDB)
   End Function

   Public Function Load_PList() As Data.DataSet
       Try
           'On Error Resume Next
           Dim Itm As ListViewItem
           Dim I As Long
           Dim strConnect, strSql As String
           Dim objDA1 As New OdbcDataAdapter
           Dim objDS1 As New Data.DataSet
           Dim intCounter As Integer
           Dim mvarSysProjPath As String = strDriveLetter & ":\Dad\Files\Playlist\"
           strConnect = "Provider=MSDASQL/SQLServer ODBC;Driver={Microsoft Visual FoxPro Driver};" _
             & "SourceType=DBF;SourceDB=" & mvarSysProjPath _
             & ";InternetTimeout=300000;Transact Updates=True"

           strSql = "SELECT CUT, COMMENT FROM " & strDB & ".dbf"
           objDA1 = New OdbcDataAdapter(strSql, strConnect)
           objDA1.Fill(objDS1, strDB)

           Fill_Search()

           PlayList.ProgressBar1.Value = "0"
           PlayList.ProgressBar1.Maximum = objDS1.Tables(strDB).Rows.Count
           PlayList.ProgressBar1.Minimum = "0"
           For I = 0 To objDS1.Tables(strDB).Rows.Count - 1
               With objDS1.Tables(strDB).Rows(I)
                   strCut = Replace(!CUT, " ", "")
                   strComment = !Comment
                   If strCut.Length > 0 Then
                       Call Load_Cuts()
                   Else
                       Call Load_Comment()
                   End If
               End With
           Next I

           objDS1.Dispose()
           objDS2.Dispose()
           intRow = 0

           I = strPList

           MainForm.lblPListTitle(I).Text = strDB

           Load_MediaPlayer()

       Catch ex As Exception
           'Maybe add Event to system log
       End Try

   End Function

   Public Function Load_Cuts() As DataSet
       Dim strLCount As String
       Dim Itm(7) As ListViewItem
       Dim I As Long
       Dim j As Long

       intArgs = 1
       I = strPList
       Dim dv As DataView = objDS2.Tables(0).DefaultView
       Dim dr As DataRow
       dv.Sort = "CUT"

       intRow = dv.Find(strCut)
       j = intRow

       k = MainForm.PlayListView(I).Items.Count

       If j = -1 Then

           Itm(I) = MainForm.PlayListView(I).Items.Add("N/A")
           Itm(I).BackColor = Color.Red
           Itm(I).SubItems.Add(strCut)
           Itm(I).SubItems.Add("No Database Entry Found")
           Itm(I).SubItems.Add("0.0")
           Itm(I).SubItems.Add("0.0")
           Itm(I).SubItems.Add("0.0")
           Itm(I).SubItems.Add("N/A")
       Else
           With dv(j)
               strFileName = Replace(!LOCATION, " ", "") & "\cuts\" & !CUT & "." & !EXT
               If System.IO.File.Exists(strFileName) Then

                   I = strPList
                   Itm(I) = MainForm.PlayListView(I).Items.Add(!LOCATION)
                   Itm(I).SubItems.Add(!CUT)
                   Itm(I).SubItems.Add(!TITLE)
                   Itm(I).SubItems.Add(!LENGTH)
                   Itm(I).SubItems.Add(!STARTTIME)
                   Itm(I).SubItems.Add(!ENDTIME)
                   Itm(I).SubItems.Add(!EXT)
               Else
                   Itm(I) = MainForm.PlayListView(I).Items.Add(!LOCATION)
                   Itm(I).BackColor = Color.Red
                   Itm(I).SubItems.Add(!CUT)
                   Itm(I).SubItems.Add("File Not Found!")
                   Itm(I).SubItems.Add(!LENGTH)
                   Itm(I).SubItems.Add(!STARTTIME)
                   Itm(I).SubItems.Add(!ENDTIME)
                   Itm(I).SubItems.Add(!EXT)
                   strLogFile = Format(Now, "HH:mm:ss tt") & "     " & !Cut & "     " & strTitle & "     File Not Found"
                   ListManager("Audio_Error")
               End If
           End With
       End If

       PlayList.ProgressBar1.Value = (PlayList.ProgressBar1.Value + 1)
       If PlayList.ProgressBar1.Value = PlayList.ProgressBar1.Maximum Then
           MainForm.PlayListView(I).Items(0).Selected = True
           If Refresh = False Then
               PListIndex(I) = MainForm.PlayListView(I).SelectedItems(0).Index
           End If
           objDS2.Reset()
       End If

   End Function

   Public Sub Load_Comment()
       Dim Itm(7) As ListViewItem
       Dim j
       Dim i
       i = strPList

       Itm(i) = MainForm.PlayListView(i).Items.Add("")
       Itm(i).BackColor = Color.Yellow
       Itm(i).SubItems.Add("")
       Itm(i).SubItems.Add(strComment)
       Itm(i).SubItems.Add("")
       Itm(i).SubItems.Add("")
       Itm(i).SubItems.Add("")
       Itm(i).SubItems.Add("")

   End Sub

End Module

 

I watched Task Manager and nothing new Showed up. It does take a few seconds for the list to load so I should have seen it.

 

Thanks

 

ZeroEffect

Edited by ZeroEffect

If you can't find it, Build It.

 

There is no place Like 127.0.0.1 also don't forget 1 + 1 = 10

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...