Take a look at the following. The question near the end of the code - in the "whoAmI" function...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace MY_TEST_PROJECT
{
// a form class
public partial class frmTestForm1 : Form
{
// zillion lines of code
private void aFunction()
{
ClassTest.whoAmI(this);
}
// zillion lines of code
}
// another form class...
public partial class frmTestForm2 : Form
{
// zillion lines of code
private void aFunction()
{
ClassTest.whoAmI(this);
}
// zillion lines of code
}
// a home made test class
public static class ClassTest
{
// zillion lines of code
public static void whoAmI(Form theForm)
{
// IS THERE A WAY TO SEE WHAT KIND OF FORM theForm IS?
// LIKE:
// if (theForm IS A frmTestForm1)
// doThis();
// else if (theForm IS A frmTestForm2)
// doThat();
}
// zillion lines of code
}
}