-1
스레드를 크립하고 데이터 세트를 읽고 해당 레코드를 Excel에 쓰고 있습니다. 그러나 스레드가 전체 레코드를 읽지 않고 중간에 25 개의 레코드를 읽은 후 중단됩니다.스레드가 던지고있다 HRESULT 800ac472 오류
If dsCostUsage.Tables(0).Rows.Count > 150 Then
Dim t As New Thread(AddressOf FillDataRows1)
t.Start(worksheet)
End If
Private Sub FillDataRows1(ByVal ws As Worksheet)
Dim startuprow As Integer = 7
Dim colpointer As Integer = 0
Dim rowpointer As Integer = 0
Dim str As String
While rowpointer <= dsCostUsage.Tables(0).Rows.Count - 1
While colpointer <= dsCostUsage.Tables(0).Columns.Count - 1
str = dsCostUsage.Tables(0).Rows(rowpointer)(colpointer).ToString()
DirectCast(ws.Cells(startuprow, colpointer + 1), Range).Value2 = item
colpointer += 1
End While
colpointer = 0
rowpointer += 1
startuprow += 1
End While
End sub
중간에 깨는 정확한 이유는 모르겠다. 어쨌든 시간을 늘리거나 다른 것이있는 것이 있습니까?
작업자 스레드가 쓰기를 완료하기 전에 주 스레드가 완료되고 작업자 스레드가 계속 중단되지 않을 것이라고 생각합니다. 당신은 t.Join를 호출을 시도 할 수