((Form1)this.Owner).FiltreMonDataGrid(rbtnlChoices.SelectedValue, txtValue.Text);
ça marche pas très bien
private void OuvrirForm2() { Form2 monForm2 = new Form2(); // Lorsque l'indice sélectionné de ton filtre change, // on appelle la méthode Filtre_SelectedIndexChanged monForm2.Filtre.SelectedIndexChanged += Filtre_SelectedIndexChanged; monForm2.Show(); } private void Filtre_SelectedIndexChanged(object sender, EventArgs e) { // sender correspond à l'objet ayant appelé l'événement // c'est-à-dire le filtre ComboBox filtre = sender as ComboBox; if (filtre != null) { // Là, tu as accès à ton filtre donc tu peux faire tout ce que tu veux avec. // Tu peux par exemple utiliser filtre.SelectedText ou filtre.SelectedValue } }
public string nom(variable) { string sNm = "x"; return sNm; }
public string get_name_cell() { string name_cell = dataGridView1.Columns[0].HeaderText; return name_cell; }
public class LigneUser { public string ID { get; set; } public string Prenom { get; set; } public string Nom { get; set; } public string Etage { get; set; } public string IP { get; set; } public string Poste { get; set; } public string Modele { get; set; } public string Pass_Systeme { get; set; } public string Pass_Zimbra { get; set; } }
private void rechercherToolStripMenuItem_Click(object sender, EventArgs e) { Form8 f8 = new Form8(); f8.Owner = this; f8.Show(); }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionpublic class Form1 { public void FiltreMonDataGrid(string ptype, string pvalue) { // le code qui va bien avec un switch tout-ça-tout-ça ... } }
public class Form2 { protected void btnSearch_Click(object sender, EventArgs e) { // on appelle la fonction de Form1 this.Owner.FiltreMonDataGrid(rbtnlChoices.SelectedValue, txtValue.Text); // on ferme cette fenêtre qui n'a plus lieu d'être this.Close(); } }
Form8 f8 = new Form8(); f8.Show(); string sFiltre = f8.tFiltre.Text; int iFiltre = f8.iFiltre.Text;