这是我得到的代码,它没有错误,但似乎不起作用。能以某种方式告诉我它有什么问题吗?
Dim frmCurrentForm As Form
Dim wasFocused As Boolean = False
For Each frmCurrentForm In Application.OpenForms
If Not frmCurrentForm Is Nothing Then
Dim action As Action(Of Form)
action = Sub(form)
If form.Focused() Then
Dim failedLoginForm As New frmFailedLogin
failedLoginForm.setError("failed blah blah")
'failedLoginForm.Parent = form
failedLoginForm.StartPosition = FormStartPosition.CenterParent
failedLoginForm.ShowDialog()
wasFocused = True
End If
End Sub
If (frmCurrentForm.InvokeRequired) Then
frmCurrentForm.Invoke(action, New Object() {frmCurrentForm})
Else
action(frmCurrentForm)
End If
If wasFocused Then
Exit For
End If
End If
Next