Exemple #1
0
        private void initLis()
        {
            dtgMenus.Columns.Clear();
            dtgMenus.DefaultCellStyle.ForeColor = Color.Black;
            dtgMenus.ColumnCount     = 3;
            dtgMenus.Columns[0].Name = "ID Menu";
            dtgMenus.Columns[1].Name = "Descripcion";
            dtgMenus.Columns[2].Name = "Precios";
            string[]    row          = new string[] { "id", "descripcion", "precio" };
            menu        men          = new menu();
            DAOMenu     dAOMenu      = new DAOMenu();
            List <menu> listadoMenus = dAOMenu.listaMenus().ToList();

            foreach (var item in listadoMenus)
            {
                row = new string[] {
                    item.id_menu.ToString(),
                         item.descripcion,
                         item.precio.ToString()
                };
                dtgMenus.Rows.Add(row);
            }
            Commons.anchoColumna(dtgMenus);
        }