private void LoadData() { RegisterAppLayer ObjAppLayer = new RegisterAppLayer(); List <RegDetails> listUser = ObjAppLayer.GetPersonDetails(); if (listUser.Count > 0) { UserGridView.Rows.Clear(); DataGridViewRow row; int i = 0; foreach (var RegDetails in listUser) { row = new DataGridViewRow(); UserGridView.Rows.Add(); row = UserGridView.Rows[i]; row.Cells["ColFirstName"].Value = RegDetails.FirstName; row.Cells["ColLastName"].Value = RegDetails.LastName; row.Cells["ColEmail"].Value = RegDetails.Email; row.Cells["ColMobile"].Value = RegDetails.Mobile; row.Cells["ColUserName"].Value = RegDetails.UserName; i++; } UserGridView.ClearSelection(); } }