The following code throws an exception if the forms title is empty:
Code: Select all
foreach (Form form in Application.Forms)
{
try
{
if (form.Text.Contains("Microsoft Word"))
{
// do something
}
}
catch (CommandFailedException)
{ }
}
Peter