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 btn_New_Click(object sender, EventArgs e)
         {
             lbl_id.Text = "id";

             cbo_type.Text = "Administrator";

             config.Load_DTG("Select user_id as 'ID' ,name as 'Name',user_name as 'Username',type as 'Type' From user", dtg_listUser);
             dtg_listUser.Columns[0].Visible = false;

             if(lbl_id.Text == "id")
             {
                 btn_update.Enabled = false;
                 btn_delete.Enabled = false;
                 btn_saveuser.Enabled = true;
             }
             else
             {
                 btn_saveuser.Enabled = false;
                 btn_update.Enabled = true;
                 btn_delete.Enabled = true;
             }

             funct.clearTxt(Panel1);
         }