public void SetAccountItemGridView(Accounts accounts) { AccountItemsGridView.Rows.Clear(); var accountItems = accounts.Display(MonthPicker.Value); if (accountItems.Count() > 0) { AccountItemsGridView.Rows.Add(accountItems.Count()); for (int i = 0; i < accountItems.Count(); i++) { AccountItemsGridView.Rows[i].Cells[0].Value = accountItems.ElementAt(i).Name; AccountItemsGridView.Rows[i].Cells[1].Value = accountItems.ElementAt(i).Category; AccountItemsGridView.Rows[i].Cells[2].Value = accountItems.ElementAt(i).Amount; AccountItemsGridView.Rows[i].Cells[3].Value = accountItems.ElementAt(i).OccuredTime.ToString("yyyy/MM/dd hh:mm"); AccountItemsGridView.Rows[i].Cells[4].Value = accountItems.ElementAt(i).Content; AccountItemsGridView.Rows[i].Cells[5].Value = accountItems.ElementAt(i).Note; } } AccountItemsGridView.ClearSelection(); }
private void MainForm_Shown(object sender, EventArgs e) { AccountItemsGridView.ClearSelection(); }