The type 'marsweb.imageimpacts.UpdateCustomerInvoice' already contains a definition for 'pageSize'

Posted by Sudheep.grandhe under C# on 12/16/2011 | Points: 10 | Views : 977 | Status : [Member] | Replies : 2
Hi,

i wrote the coding for Paging for DataGridView Control in Windows C# Application.it shows the following error.


Error:1 The type 'marsweb.imageimpacts.UpdateCustomerInvoice' already contains a definition

public partial class UpdateCustomerInvoice : Form
{

private DataTable dtSource = new DataTable();
static int currentPageIndex = 0;
private int pageSize = 5;
public int pageSize// error comes here
{
set
{
this.pageSize = value;
}
get
{
return this.pageSize;
}
}
The type 'marsweb.imageimpacts.UpdateCustomerInvoice' already contains a definition for 'pageSize'

Best,
Sudheep.



Responses

Posted by: Nilschaudhari on: 12/16/2011 [Member] Starter | Points: 25

Up
0
Down
hi,

as per your code seen I can suggest you change the name of variable as shown

public partial class UpdateCustomerInvoice : Form
{

private DataTable dtSource = new DataTable();
static int currentPageIndex = 0;
private int _pageSize = 5;
public int pageSize// error comes here
{
set
{
_pageSize = value;
}
get
{
return _pageSize;
}
}


Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Sudheep.grandhe on: 12/16/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

Thanks for replying to me.As you said i change it will shows another error.can you please fix the error.please do the needful.here is my code.

public void bindgrid()
{
if (dtSource.Rows.Count > 0)
{
DataTable tmptable = dtSource.Clone();
int startIndex = currentPageIndex * _pageSize;
int endIndex = currentPageIndex * _pageSize + _pageSize;
if (endIndex > dtSource.Rows.Count)
{
endIndex = dtSource.Rows.Count;
}
for (int i = startIndex; i < endIndex; i++)
{
DataRow newRow = tmptable.NewRow();
GetNewRow(ref newRow, dtSource.Rows[i]);Error1The name 'GetNewRow' does not exist in the current context
tmptable.Rows.Add(newRow);
}
dataGridView1.DataSource = tmptable;
lblRecordStatus.Text = (currentPageIndex + 1) + " / " + (int)Math.Ceiling(Convert.ToDecimal(dtSource.Rows.Count) / _pageSize );
}
}

Best,
Sudheep.

Sudheep.grandhe, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response