Start like this:
foreach (Control c in f.Controls)
{
Button b = c as Button;
if (b != null)
{
...
}
}
This eliminates all Controls that are not Buttons, and allows you to use all Button properties on the ones that are.
Do yourself a favour: don't "swallow" exceptions.
At the very least log them somewhere before you ignore them, so that if you need teh information you can get access to it - if only in debugging.
...
catch (Exception ex)
{
Debug.WriteLine(ex.Message);
}
Swallowing exceptions means you don't even know there is a problem until it becomes too late and makes it very, very hard to fix them as you have discarded teh info that would tell you what happened!