Thursday, May 17, 2012

datagridview ให้แสดงลำดับที่




int startno = 0;
private void datagridview_RowsRemoved(object sender, datagridviewRowsRemovedEventArgs e)
{
int no= this.startno; // Assign Start current Voucher Number
for(int x=0;x<datagridview.RowCount-1;x++)
{
grdDailySale.Rows[x].Cells["Title"].Value = no+= 1; // Sorting new number
}
}
 
 
 
private void datagridview_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
{
int no= this.startno; // Assign Start current Voucher Number
for(int x=0;x<datagridview.RowCount-1;x++)
{
grdDailySale.Rows[x].Cells["Title"].Value = no+= 1; // Sorting new number
}
}
 

No comments:

Post a Comment