Private Sub btnRentM_Click(sender As Object, e As EventArgs) Handles btnRentM.Click ID = dgvRentAllCarsM.Rows(CurrentRecord).Cells(0).Value Dim RentalInfo = (From aRental In CarRentaldb.Rentals Where aRental.RentalID = ID Select aRental).FirstOrDefault RentalInfo.RentalID = txtRentRentalIDM.Text RentalInfo.CarID = txtRentCarIDM.Text RentalInfo.CustomerCivilID = txtCustomerCivilIDM.Text RentalInfo.StaffID = txtRentStaffIDM.Text RentalInfo.StartDate = dtpRentStartM.Text RentalInfo.EndDate = dtpRentEndM.Text RentalInfo.ActualDate = dtpRentActualM.Text RentalInfo.PenaltyForLate = txtRentPenaltyForLateM.Text RentalInfo.PenaltyForDamage = txtlblRentPenaltyForDamageM.Text MsgBox("A new car is rented") CarRentaldb.Rentals.Add(RentalInfo) CarRentaldb.SaveChanges() UpdateAllRentals() CurrentRecord = 0 dgvRentAllCarsM.Rows(CurrentRecord).Selected = True DisplayRentalInfo() End Sub
Quote:"Index was out of range. Must be nonnegative and less than the size of the collection"
CurrentRecord
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)