示例#1
0
        /// <summary>
        /// dropdown in menu option which opens a new file to type in the code
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void newFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //newfile object creation
            NewFile obj = new NewFile();

            this.Hide();
            obj.Show();
        }
示例#2
0
        /// <summary>
        /// method that runs when open file dropdown option is clicked
        /// a new text file is read when done that with help of a dialogbox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void openFileToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Stream         myStream;
            OpenFileDialog opn = new OpenFileDialog();

            if (opn.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if ((myStream = opn.OpenFile()) != null)
                {
                    string strFileName = opn.FileName;
                    string filetext    = File.ReadAllText(strFileName);

                    NewFile obj = new NewFile();
                    obj.copyText(filetext);

                    this.Hide();
                    obj.Show();
                }
            }
        }