G
Guest
Hi all,
Another beginner's question:
I want to have some common functionality to all my forms. The way I think of
doing this is to have some class that will inherit from a Form, and in this
class define the common functionality that I want, and all my forms will
inherit from this class.
For example:
public partial class MySpecialClass : Form
{
public static int MyintVariable;
private void Functionality()
{
//do some work
}
}
And all my forms will look something like this:
public partial class Form1 : MySpecialClass
{
public Form1()
{
InitializeComponent();
}
}
1. Is it a good way of doing this?
2. Do I need to define a constructor for MySpecialClass?
3. I don't need the graphic interface for MySpecialClass, I only need its
code. Where is the place to put code that does not belong to a form/graphic
interface ?
Thank you very much
Another beginner's question:
I want to have some common functionality to all my forms. The way I think of
doing this is to have some class that will inherit from a Form, and in this
class define the common functionality that I want, and all my forms will
inherit from this class.
For example:
public partial class MySpecialClass : Form
{
public static int MyintVariable;
private void Functionality()
{
//do some work
}
}
And all my forms will look something like this:
public partial class Form1 : MySpecialClass
{
public Form1()
{
InitializeComponent();
}
}
1. Is it a good way of doing this?
2. Do I need to define a constructor for MySpecialClass?
3. I don't need the graphic interface for MySpecialClass, I only need its
code. Where is the place to put code that does not belong to a form/graphic
interface ?
Thank you very much