所有在用的客户端,只有两个客户端会偶尔报错,报错原因为 不存在名称为 "Main" 的窗口
但是,Main是主窗口,系统在运行的时候,这个窗口不可能关闭或者不存在,下面是报错事件的代码,老师帮忙看看有啥问题没
If Forms.Contains("Main") Then
If QQClient.Ready Then
If Forms("Main").Opened Then
Dim OpenQQ As WinForm.Button = Forms("Main").Controls("OpenQQ")
Static LastTime As Date
Dim txt As String
If QQClient.UnreadCount > 0 Then
txt = "(" & QQClient.UnreadCount & "条)"
End If
If OpenQQ.Text <> txt Then
OpenQQ.Text = txt
End If
If OpenQQ.Text > "" Then
Dim ntp As timeSpan = Date.Now - LastTime
If ntp.TotalSeconds >= 0.5 Then
LastTime = Date.Now
If OpenQQ.ForeColor = Color.Red Then
OpenQQ.ForeColor = Color.Transparent
Else
OpenQQ.ForeColor = Color.Red
End If
End If
End If
End If
End If
End If