mercredi 3 septembre 2014

c# datagridview how to pass value using txtbox in other form


Vote count:

0





  • form1 i got a gui buttons to pick

  • form2 is my datagridview

  • form3 is where i input the name surname and mi

  • my code for form1 is form2.show

  • on my form2 is form3.show

  • i have a code in form3 that uses a counter to input in datagridView1




private void btnAdd_Click(object sender, EventArgs e)
{
int counter = 0;
if (dataGridView1.Rows.Count > 1)
{
while (counter != dataGridView1.Rows.Count - 1)
{
if (dataGridView1.Rows[counter].Cells[0].Value.ToString() ==txtName.Text)
{
MessageBox.Show("name already exist");
return;
}
counter++;
}
}



  • my problem is that form3 dont recognize dataGridView1 how do i get the value of textbox in form3 into datagridview in form2.



asked 24 secs ago







c# datagridview how to pass value using txtbox in other form

Aucun commentaire:

Enregistrer un commentaire