これが私が得たコードで、エラーはありませんが、機能していないようです。どういうわけかそれの何が悪いのか教えてもらえますか?
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