I have a context problem with c#
<p>I have a problem with 2 Windows Forms which I created in c#. The first form (menu) has a PrintPreviewDialog object. The "menu" form then instantiates a copy of the send class "file" and call a ShopDialog method.</p>

<p>The "file" class write a file and calls a method (direct) in the "menu" class.</p>

<p>The problem I have is that the "direct" method is not known to the "menu" class. I think the answer is to define a copy of "menu" class in the "file", but I can't see have to do that.</p>

<p>Thanks for any help in advance.</p>

<p>John</p>

<hr>

<pre><code>namespace CSharp
{
    public partial class MainMenu : Form
    {
        // Fields for printing.
        public PrintDocument printDocument1 = new PrintDocument();
        PageSettings printPageSettings = new PageSettings();
        static RichTextBox printRichTextBox = new RichTextBox();
        static string stringToPrint = "";
        Font printFont = new Font("Arial", 10);


        /****************************************************
         *  Select the Data-&gt;File-IO menu item.             *
         ****************************************************/

        private void fileIoToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            File_IO fileIoDialog = new File_IO();

            fileIoDialog.ShowDialog();
        }

  /****************************************************
         *  Initiate the printing process. The data to be   *
         *  printed will be read from a file and stored in a*
         *  rich text box.  The print menu buttons are      *
         *  enabled.                                        *
         ****************************************************/

        public static void PrintInitialise(String printSource)
        {
            try
            {
                // Read text file and load into printRichTextBox.
                FileStream printStream = new FileStream(printSource, FileMode.Open, FileAccess.Read);
                printRichTextBox.LoadFile(printSource, RichTextBoxStreamType.PlainText);
                printStream.Close();

                // Initialise string to print.
                stringToPrint = printRichTextBox.Text;
            }
            catch (Exception ex)
            {
                // Display error message if they appear.
                MessageBox.Show(ex.Message);
            }  
        }

        /****************************************************
         *  Select the Data-&gt;File-IO menu item.             *
         ****************************************************/

        public void PrintDirect()
        {
          printDocument1.Print();
        }


        /****************************************************
         *  Select the Data-&gt;File-IO menu item.             *
         ****************************************************/

        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
        {
            int numChars;
            int numLines;
            string stringForPage;
            StringFormat strFormat = new StringFormat();

            // Based on page setup, define drawable rectangle on page
         }
    }
}




namespace `enter code here`CSharp
{
    public partial class File_IO : Form
    {
        MainMenu mainBransom;

      public File_IO()
        {
            InitializeComponent();
        }


private void btnPrint_Click(object sender, EventArgs e)
        {
            MainMenu.PrintInitialise(printSource);
mainBransom.PrintDirect();
        }
</code></pre>
