private void btnThem_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (them) { tbTenTL.Clear(); //mã thể loại tự tăng string maTL = nextMa(TheLoai_BUS.LastMaTL()); them = false; TLbindingSource.AddNew(); //GÁN vào textbox và gridview gvTheLoai.SetFocusedRowCellValue(colMaTL, maTL); tbMaTL.Text = maTL; //trỏ tới dòng cuối cùng trong gridview gvTheLoai.FocusedRowHandle = gvTheLoai.RowCount - 1; tbTenTL.Focus(); } else { gvTheLoai.FocusedRowHandle = gvTheLoai.RowCount - 1; tbTenTL.Focus(); } }