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 btnnew_Click(object sender, EventArgs e)
         {

             inc = 0;

             sql = "SELECT * FROM tblitems";
             config.Load_DTG(sql, dtglist);

             maxcolumn = dtglist.Columns.Count - 1;

             dtglist.Columns[maxcolumn].Visible = false;

             btnadd.Visible = false;

             select_navigation("SELECT ITEMID FROM tblitems");
             lblmax.Text = maxrow.ToString();
             lblinc.Text = inc.ToString();

             sql = "SELECT DESCRIPTION FROM `tblsettings` WHERE `PARA`='CATEGORY'";
             config.fiil_CBO(sql, cbotype);

             sql = "SELECT DESCRIPTION FROM `tblsettings` WHERE `PARA`='Unit'";
             config.fiil_CBO(sql, cbounit);


             funct.clearTxt(pnl_stockmaster);

         }