another problem..i have a form which shows in some textboxes, the selected row in the dgv, and also i added some picturebox for the next and previous record. i don't know what's wrong..it shows the next record only at the first click, then stops. Here's the code:
private void pictureBox1_Click(object sender, EventArgs e)
{
System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();
conn.ConnectionString = "..";
conn.Open();
Acasa main = (Acasa)Application.OpenForms["Acasa"];
DataGridView dgv = main.clientGridView;
int i = dgv.CurrentRow.Index;
int maxRows = dgv.Rows.Count;
if (i != maxRows - 1)
{
i++;
textBox1.Text = dgv.Rows[i].Cells[0].Value.ToString();
textBox2.Text = dgv.Rows[i].Cells[1].Value.ToString();
textBox3.Text = dgv.Rows[i].Cells[2].Value.ToString();
textBox4.Text = dgv.Rows[i].Cells[3].Value.ToString();
textBox5.Text = dgv.Rows[i].Cells[4].Value.ToString();
conn.Close();
}
else
{
MessageBox.Show("..");
}
}
i really appreciate your help..