private void JO_Tool_ReadAuthors_Click(object sender, EventArgs e) { //If setup for grid has already been done, just refresh the grid. if (_gridSetupDone == true) { RefreshGrid(); return; } JO_DataGrid_Authors.AutoGenerateColumns = false; JO_DataGrid_Authors.ColumnCount = 3; JO_DataGrid_Authors.DataSource = BiblioQueries.GetAuthors(connection); //Hide author id row for later to use. JO_DataGrid_Authors.Columns[0].Name = "AuthorID"; JO_DataGrid_Authors.Columns[0].DataPropertyName = "AuthorID"; JO_DataGrid_Authors.Columns[0].Visible = false; JO_DataGrid_Authors.Columns[1].Name = "Name"; JO_DataGrid_Authors.Columns[1].DataPropertyName = "Name"; JO_DataGrid_Authors.Columns[2].Name = "Year Born"; JO_DataGrid_Authors.Columns[2].DataPropertyName = "YearBorn"; _gridSetupDone = true; }
private void SyncAuthors() { var watch = System.Diagnostics.Stopwatch.StartNew(); JO_ListBox_Authors.DataSource = BiblioQueries.GetAuthors(connection); JO_Lbl_AuthorsCount.Text = JO_ListBox_Authors.Items.Count.ToString(); watch.Stop(); var elapsedMs = watch.ElapsedMilliseconds; JO_Lbl_AuthorsTimeTaken.Text = elapsedMs.ToString() + " ms"; }
private void RefreshGrid() { JO_DataGrid_Authors.DataSource = BiblioQueries.GetAuthors(connection); }