以下代码使应用程序挂起。调试时没有显示错误。
Private Sub SolarInitBtn_Click(sender As Object, e As EventArgs) Handles SolarInitBtn.Click
Try
SolarThread = New Thread(SolarThreadStart) With {
.IsBackground = True,
.Name = "SolarEnergyUpdateSystem"
}
SolarThread.Start()
Catch myError As Exception
End Try
End Sub
Public Sub SolarEnergyUpdate()
Dim Energy As Decimal = SolarStatsLbl.Text
Dim EnergyMax As Int32 = SolarMaxCapLbl.Text
If Energy <= EnergyMax Then
Dim Production As Int32 = SolarProdLbl.Text
Dim ProdTimeQt As Decimal = FormatNumber(CDec(Production / 3600), 3) + Energy
EnergyNowLbl.Text = ProdTimeQt
Thread.Sleep(15000)
Else
SolarThread.Abort()
End If
End Sub
我尝试的是捕捉一些数字,做数学并将结果放入标签中,我希望每秒钟或至少不到1分钟。目前该申请正在悬挂。 我抓住了例外,没有。 (使用vb.NET )