Q:

Want help on inheritance of forms in c#

I have created a form which prints the average and grades of a student. I want to inherit the properties of that form to another form. How can it be achieved? I am a beginner in c#.Please help.
this is the form from which i want to inherit
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace formstud
{
public partial class Form1 : Form
{
    public Form1()
    {
         InitializeComponent();
    }

    private void textBox1_TextChanged(object sender, EventArgs e)
    {

    }

    private void textBox2_TextChanged(object sender, EventArgs e)
    {

    }

    private void button1_Click(object sender, EventArgs e)
    {
        String str = textBox1.Text;
        textBox2.Text = str;
    }

    private void button1_Click_1(object sender, EventArgs e)
    {
        int a, b, c, d;
        a = Convert.ToInt32(textBox3.Text);
        b = Convert.ToInt32(textBox4.Text);
        c = Convert.ToInt32(textBox5.Text);
        d = (a + b + c) / 3;
        if (d <= 50 && d >= 40)
        {
            label1.Text = "A";
        }
        else if (d >= 30 && d <= 40)
        {
            label1.Text = "B";
        }
        else
            label1.Text = "C";
        label7.Text = Convert.ToString(d);

    }

    private void label1_Click(object sender, EventArgs e)
    {

    }

    private void label7_Click(object sender, EventArgs e)
    {

    }
}

}

this is the derived form i created
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace formstud
{
public partial class Form2 : formstud.Form1
{
    public Form2()
    {
        InitializeComponent();
    }
}
}

A:

You need to do the following :-
 public partial class Form1 : Form
    {
        public int PropertyA { get; set; }
        public int PropertyB { get; set; }

        public Form1()
        {
            InitializeComponent();
        }
    }

 public partial class Form2 : Form1
    {
        public Form2()
        {
            InitializeComponent();

            PropertyA = 1;
            PropertyB = 2;
        }
    }

A quick Explanation on this. In Form1, I have created two Public properties, PropertyA and PropertyB.
I then create Form2, only this time i inherit from the Form1 class, rather than Form. This gives me access to PropertyA & PropertyB, without declaring them.
This is just one example, you could draw up an interface, which is kinda like a contract, that suggests any form I build, where i quote this interface, it must implement these properties. 
public interface IProperties
    {
        int PropertyA { get; set; }
        int PropertyB { get; set; }
    }

Now Form1 & Form2 can just look like this :-
public partial class Form2 : Form, IProperties
{
    public Form2()
    {
        InitializeComponent();

    }

    public int PropertyA { get; set; }
    public int PropertyB { get; set; }
}

