Hi,<BR>I am using an Excel like data grid with add,delete,edit features(i got the code from msdn).while iam running that sample as it is it runs properly without any error(with access db).but when i made some changes to the fields as per my requirment(with sql server db),i couldn&#039;t add(edit delete works properly) new records through that grid.it shows the following error<BR>----------------------------------------------------------------<BR>Invalid CurrentPageIndex value. It must be &#062;= 0 and &#060; the PageCount. <BR>here is the code of that part<BR>Private Function SetIndexesToLastPage(ByVal dt As DataTable) As Integer<BR> Dim nRemainder As Integer = (dt.Rows.Count Mod PageSize)<BR> Dim nNewItemIndex As Integer = nRemainder<BR><BR> CurrentPageIndex = (dt.Rows.Count / PageSize) &#039; 0-based<BR> If nNewItemIndex = 0 Then<BR> CurrentPageIndex = CurrentPageIndex - 1<BR> nNewItemIndex = PageSize - 1<BR><BR> Else<BR> nNewItemIndex = nNewItemIndex - 1<BR> End If<BR><BR> Return nNewItemIndex<BR> End Function<BR>----------------------------------------------------------------<BR>could anyone pls help me to overcome this error.<BR>Thanks