Hi,
Try the following code. The first column can't be an identity or key.
namespace Test
{
public partial class Form2 : Form
{
//default values in the grid
List<object[]> _values = new List<object[]>();
DataTable _table = new DataTable();
DataColumn _seq = new DataColumn("Seq", typeof(System.Int32));
DataColumn _name = new DataColumn("Name", typeof(System.String));
public Form2()
{
InitializeComponent();
// add the columns
_table.Columns.AddRange(new DataColumn[] {_seq, _name });
//assign values to grid (mis adorados hijos)
_values.Add(new object[]{"3", "Ale"});
_values.Add(new object[]{ "5", "Dodi"});
_values.Add(new object[]{ "7", "Chechar"});
for (int i = 0; i < _values.Count; i++)
{
_table.LoadDataRow(_values[i], true);
}
this.dataGridView1.DataSource = _table;
}
private void button1_Click(object sender, EventArgs e)
{
this.dataGridView1.Rows[0].Selected = true;
int _newvalue = Int32.Parse(this.textBox1.Text);
int _increment = Int32.Parse(this.textBox2.Text);
for (int i = 0; i < this.dataGridView1.Rows.Count-1; i++)
{
this.dataGridView1.Rows[i].Cells["Seq"].Value = _newvalue;
_newvalue += _increment;
}
}
}
}
best regards