private void JO_Btn_Titles_Click(object sender, EventArgs e) { int rowIndex = JO_DataGrid_Authors.SelectedCells[0].RowIndex; int authorID = (int)JO_DataGrid_Authors.Rows[rowIndex].Cells["AuthorID"].Value; JO_DataGrid_Titles.Rows.Clear(); foreach (string item in BiblioQueries.GetTitles(authorID, connection)) { JO_DataGrid_Titles.Rows.Add(item); } }
private void JO_Btn_Titles_Click(object sender, EventArgs e) { if (JO_ListBox_Authors.SelectedIndex == -1) { return; } var watch = System.Diagnostics.Stopwatch.StartNew(); Author author = (Author)JO_ListBox_Authors.SelectedItem; JO_ListBox_Titles.DataSource = BiblioQueries.GetTitles(author.AuthorID, connection); var elapsedMs = watch.ElapsedMilliseconds; JO_Lbl_TitlesTimeTaken.Text = elapsedMs.ToString() + " ms"; JO_Lbl_TitlesCount.Text = JO_ListBox_Titles.Items.Count.ToString(); JO_ListBox_Titles.SelectedIndex = -1; }