Tuesday, October 2, 2012
Monday, October 1, 2012
DataSet,DataBinding,BindingSource
http://blogs.msdn.com/b/dchandnani/archive/2005/03/15/396387.aspx
http://blogs.msdn.com/b/dchandnani/archive/2005/03/09/391308.aspx
http://ramsonit.wordpress.com/2008/05/01/databinding-basics/
http://ramsonit.wordpress.com/category/c/
http://dotnetfacts.blogspot.in/
http://windowsclient.net/blogs/faqs/archive/2006/07/12/what-is-a-bindingsource-and-why-do-i-need-it.aspx
http://www.csharptalk.com/2010/03/how-to-create-relations-in-c-dataset.html
http://csharp.net-informations.com/dataset/dataset-multiple-tables-sqlserver.htm
http://beta.c-sharpcorner.com/uploadfile/john_charles/data-binding-in-windows-forms-2-0/
http://www.c-sharpcorner.com/UploadFile/cd19b9/how-to-download-datatable-to-text-file-in-C-Sharp/
http://blogs.msdn.com/b/dchandnani/archive/2005/03/09/391308.aspx
http://ramsonit.wordpress.com/2008/05/01/databinding-basics/
http://ramsonit.wordpress.com/category/c/
http://dotnetfacts.blogspot.in/
http://windowsclient.net/blogs/faqs/archive/2006/07/12/what-is-a-bindingsource-and-why-do-i-need-it.aspx
http://www.csharptalk.com/2010/03/how-to-create-relations-in-c-dataset.html
http://csharp.net-informations.com/dataset/dataset-multiple-tables-sqlserver.htm
http://beta.c-sharpcorner.com/uploadfile/john_charles/data-binding-in-windows-forms-2-0/
http://www.c-sharpcorner.com/UploadFile/cd19b9/how-to-download-datatable-to-text-file-in-C-Sharp/
DataGridView Auto Number After Binding The Data
Auto generate row number in DataGridView in windows application. Its simple below code shows how to do that.
//Auto Generate number
public void AutoNumberRowsForGridView(DataGridView dataGridView)
{
if (dataGridView != null)
{
for (int count = 0; (count <= (dataGridView.Rows.Count - 2)); count++)
{
dataGridView.Rows[count].HeaderCell.Value = string.Format((count + 1).ToString(), "0");
}
}
}
And Display Numbers In DataGridView First Cell:
private void dataGridViewAutoNumber()
{
for (int row = 0; row < dataGridView1.RowCount - 1; row++)
{
dataGridView1.Rows[row].Cells[0].Value = row + 1;
}
}
Just you need to pass your datagridview in below function and it will generate auto number to Header cell.
NOTE: First you have to bind the datagridview with data then call the below function.
Using C# code
public void AutoNumberRowsForGridView(DataGridView dataGridView)
{
if (dataGridView != null)
{
for (int count = 0; (count <= (dataGridView.Rows.Count - 2)); count++)
{
dataGridView.Rows[count].HeaderCell.Value = string.Format((count + 1).ToString(), "0");
}
}
}
And Display Numbers In DataGridView First Cell:
private void dataGridViewAutoNumber()
{
for (int row = 0; row < dataGridView1.RowCount - 1; row++)
{
dataGridView1.Rows[row].Cells[0].Value = row + 1;
}
}
Subscribe to:
Posts (Atom)