Bonjour,
j'ai un dataGridView dans Form4 et un TextBox dans Form6,est t'il possible d'envoyer la cellule sélectionnée de dataGridView vers le textBox,voici ce que j'ai fait mais j'ai pas de résultat dans le TextBox:
Code:
//dans la classe Form6 String sel; private void button2_Click(object sender, EventArgs e) { if (form4.DataGridView.RowCount > 0) // controle si le dataGrid n'est pas vide { sel =(string)form4.DataGridView.Rows[0].Cells[0].Value; } string connectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Documents and Settings\\Administrateur\\Bureau\\WindowsFormsApplication1\\WindowsFormsApplication1\\AppData\\Base.mdf;Integrated Security=True;User Instance=True"; SqlConnection connection = new SqlConnection(connectionString); connection.Open(); SqlCommand sql = new SqlCommand("Update journal set intitule='" + textBox2.Text + "',numerotation='" + comboBox2.SelectedItem.ToString() + "',type='" + comboBox1.SelectedItem.ToString() + "',saisie_anal='" + checkBox1.Checked.ToString() + "',mise_sommeil='" + checkBox2.Checked.ToString() + "',note='" + textBox5.Text + "',stat'" + textBox6.Text + "');", connection); connection.Close(); textBox1.Text = sel; }
merci pour l'aide
Afficher la suite