Copying and Pasting cs Code

In cs, like in almost any computer programming language, reading data from a file can be tricky. You add extra lines of code to tell the computer what to do. Sometimes you can copy and paste these lines from other peoples’ code.

For example, you can follow the pattern in this listing:

         private void newFileMaMethod()
         {
             //mainrichTextBox.Clear();
             //agr new p clilck kry to ye msg ay
             if (isFileDirty)
             {


                 DialogResult result = MessageBox.Show("Do you want to save changes ? ", "File Save", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Information);
                 //yes no k lye code
                 switch (result)
                 {

                     case DialogResult.Yes:
                         savefilemanu();
                         break;

                     case DialogResult.No:

                         break;
                     case DialogResult.Cancel:
                         MessageBox.Show("Develop by Hassan Malik ","Go to New File", MessageBoxButtons.OK);
                         //undoKlyeMethod();
                         break;

                 }

             }

             //mehod ha ye right click kr k iski defination ma ja k dekh skty ha
             clearScreen(); //agr file ma kch ni ha to clearscreen ka jo khudsy method bnaya ha wo chly

             //ye save k lye kia ha k phly koi file ni ha r dirty b ni ha r open b ni ha koi file
             isFileAlreadySave = false;
             currentOpenFileName = "";

             EnableDisableUndoRedoProcessKaMethog(false);

             messagetoolStripStatusLabel.Text = "New Document is Created ";

         }