Consider using for example properties instead of ref parameters (especially to constructors).
For example define the number as follows in form2:
public number { get; set; }
public Form2()
{
InitializeComponent();
}
Now you can refer the property from the calling side:
int number=0;
Form2 f2 = new Form2();
f2.number = number;
if (f2.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
number = f2.number;
}
The code above also checks that the dialog is closed with proper result and only if it is, the number at calling side is changed.
In order for this to work the number should also be changed somewhere in form2