Example #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Output.Text = c.getDownloads();
            var Lstemp = c.getDownloadsDTOList();

            //DataTable table = new DataTable();
            //table.Columns.Add("ID", typeof(string));
            //table.Columns.Add("NAME", typeof(string));
            //table.Columns.Add("CITY", typeof(string));

            ////table.Rows.Add(111, "Devesh", "Ghaziabad");
            ////table.Rows.Add(222, "ROLI", "KANPUR");
            ////table.Rows.Add(102, "ROLI", "MAINPURI");
            ////table.Rows.Add(212, "DEVESH", "KANPUR");

            //var columns = from t in Lstemp
            //              //orderby t.Name
            //              select new
            //              {
            //                  Date = t.getTime(),
            //                  Path = t.getInfo(),
            //                  Type = t.getType()
            //              };


            //dataGridView1.DataSource = columns.ToList();

            SortableBindingList <DownloadsDTO> downloads = new SortableBindingList <DownloadsDTO>(Lstemp);

            labelFound.Text = "Found " + Lstemp.Count + " entries";

            var bindingList = new BindingList <DownloadsDTO>(Lstemp);
            var source      = new BindingSource(downloads, null);


            dataGridView1.DataSource = source;
            helpfulMethodDataGrid();
        }
Example #2
0
        private void browsing_Button_Click(object sender, EventArgs e)
        {
            Output.Text = c.getHistory();

            var Lstemp = c.getHistoryDTOList();
            SortableBindingList <HistoryDTO> downloads = new SortableBindingList <HistoryDTO>(Lstemp);

            labelFound.Text = "Found " + Lstemp.Count + " entries";

            var bindingList = new BindingList <HistoryDTO>(Lstemp);
            var source      = new BindingSource(downloads, null);

            dataGridView1.DataSource = source;

            if (Lstemp.Count < 10000)
            {
                helpfulMethodDataGrid();
            }
            else
            {
                foreach (DataGridViewColumn column in dataGridView1.Columns)
                {
                    column.SortMode = DataGridViewColumnSortMode.Automatic;
                }
                dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;

                foreach (DataGridViewColumn column in dataGridView1.Columns)
                {
                    if (column.Width > 540)
                    {
                        column.AutoSizeMode = DataGridViewAutoSizeColumnMode.None;
                        column.Width        = 540;
                    }
                }
                dataGridView1.AllowUserToResizeColumns = true;
            }
        }