/*--------------------voila le code de form constructeur-----------------------*/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Data.SqlClient; using System.Data; using System.Data.Common; namespace WindowsFormsApplication3 { public partial class constructeur : Form { List<String> item = new List<string>(); public string l; public string le { get { return l; } set { l = value; } } public static string con; public constructeur() { InitializeComponent();le cod } private void button5_Click(object sender, EventArgs e) { } private void panel2_Paint(object sender, PaintEventArgs e) { } private void constructeur_Load(object sender, EventArgs e) { // TODO: This line of code loads data into the 'gestion_equipement.equipement' table. You can move, or remove it, as needed. this.equipementTableAdapter.Fill(this.gestion_equipement.equipement); } public static DbDataReader dr; private void plus_Click(object sender, EventArgs e) { equipementBindingSource.AddNew(); gestion_equepement.element el = new gestion_equepement.element(); el.ShowDialog(); this.equipementTableAdapter.Fill(this.gestion_equipement.equipement); //listBox1con.GetItemText(Program.co); gestion_equipement.Clear(); listBox1con.Items.Add(WindowsFormsApplication3.Program.co);*/ //listBox1con.Items.Add(equipementTableAdapter.Update(gestion_equipement.equipement)); } private void ok2_Click(object sender, EventArgs e) { } private void ok_Click(object sender, EventArgs e) { try { equipementBindingSource.EndEdit(); enre.PerformClick(); } catch (Exception ex) { MessageBox.Show("vous pouvez pas enregistrement le meme nom ici"); } Program.co = listBox1con.Text; /*if (listBox1.Text.Length > 0) { ComboBox items = new ComboBox(); items.Equals(listBox1.Text); cont.comboBox2.BeginUpdate(); cont.comboBox2.Items.Add(items); cont.comboBox2.EndUpdate(); } else { }*/ this.Close(); } private void sup_Click(object sender, EventArgs e) { listBox1con.Items.Remove(listBox1con.SelectedItem); } private void enre_Click(object sender, EventArgs e) { equipementTableAdapter.Update(gestion_equipement.equipement); } } }
/*---------------------------------------------------------------------------------------------------*/ le code de form emlement est le suivant /****************************************************************************************************/ using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace gestion_equepement { public partial class element : Form { public element() { InitializeComponent(); } private void textBox1_TextChanged(object sender, EventArgs e) { } private void ok2_Click(object sender, EventArgs e) { WindowsFormsApplication3.Program.co = textBox1.Text; this.Close(); } private void element_Load(object sender, EventArgs e) { } } }
/******************************************************************************************************/ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using System.Windows.Forms; namespace WindowsFormsApplication3 { static class Program { public static string co = ""; /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(true); Application.Run(new principalepage()); } }
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre question