hi every one i use the above code to restrict the user to enter the past date. but i am getting this error message

If NewBookingDataGridView.Item(3, 3).Value.ToString() < Now.Date.ToString() Then
                MsgBox("you are trying to save records of past date.")



            error is
           ** Index was out of range. Must be non-negative and less than the size of the collection.

Parameter name: index**

Does your dataGridView have at least 4 rows and columns? It may be that it is crashing because position (3,3) doesn't exist.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.