C#

Milliardo Messages postés 5 Statut Membre -  
 kis80 -
bonjour a tous
voila suis nouveau sur ce site et en c# aussi
je voulais savoir comment metre un item venant du combobox vers un listbox message d'erreur : Impossible de convertir implicitement le type 'int' en 'System.Windows.Forms.ListBox'

4 réponses

sam stamina Messages postés 15 Statut Membre 2
 
Montre moi le listing
0
swedikiluka Messages postés 42 Statut Membre 2
 
si j'ai bien saisi ta question,il suffit de faire
TonlistBox.item.add(toncomboBox.selectitem)
ou bien
TonlistBox.item.add(toncomboBox.text)
0
Milliardo Messages postés 5 Statut Membre
 
je vois que tu connais bien ton affaire alors permet moi de te poser encore une question, au faite je suis entrein de travailler sur mon projet d'exam
voila : j'ai un form1 ou j'ai ajouter un nouveau form2
dans le form1 j'ai une listBox avec des données (nom,date...)et je voudrai copier tout les données dans ma seconde listBox qui se trouve dans form2
voila ce que je penser fiare dans Form1 mais helas !!!

frmForm2 objForm = new frmForm2();
objForm.lstDémandes.Text = lstAffichageDemande.ToString();

imagine homer simpsons voulant faire de la trigo c'est le point ou je suis mais je bosse dur.
Merci d'avance et bonne année
0
Kis80 > Milliardo Messages postés 5 Statut Membre
 
Et si tu mettais ta listBox public
//**en form1
public lstAffichageDemande;
form2 Myform2;

private void ajout(object sender)//**un evenement
{
Myform2.Maform1=this;
}
//***en form2
form1 Myform1
//**propriété de type form1 en form2
public form1 Maform1
{
get{return Myform1;}
set{Myform1=value;}
}
this.lstAffichageDemande.items.add(Myfprm2.lstAffichageDemande.items);
....
0
Milliardo Messages postés 5 Statut Membre > Kis80
 
salut man,
apparament ca ne marche pas je crois que je me mele les pinceaux a l'endroit ou le placer alors je te joins le script
milles excuse si j'abuse de votre tmps
form1(frmExam)

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Threading;

namespace Examen1
{
/// <summary>
/// Description résumée de Form1.
/// </summary>
public class frmExamen : System.Windows.Forms.Form
{
private System.Windows.Forms.Button btnEnvoyer;
private System.Windows.Forms.Button btnQuitter;
private System.Windows.Forms.GroupBox groupBox1;
public System.Windows.Forms.ListBox lstAffichageDemande;//----mit en publique c'est cette liste de demande
// qui doit etre transferer dans la liste du frmResponssable
frmResponssable objResponssable; //------------------------------------------essaie
private System.Windows.Forms.ListBox lstRefus;
private System.Windows.Forms.ListBox lstAccord;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.GroupBox grpDemandeConge;
private System.Windows.Forms.DateTimePicker dateTimePicker2;
private System.Windows.Forms.Label lblAu;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Button btnAfficher;
private System.Windows.Forms.ComboBox cboPersonnels;
private System.Windows.Forms.ComboBox cboFonctions;
private System.Windows.Forms.ComboBox cboTypesConges;
private System.Windows.Forms.Label lblHorloge;
private System.Windows.Forms.Timer tmrHeure;
private System.Windows.Forms.Button btnMessage;
private System.Windows.Forms.GroupBox grbInfprmations;
private System.Windows.Forms.Label lblAffichageInfos;
private System.Windows.Forms.Label lblX;
private System.Windows.Forms.Label lblY;
private System.Windows.Forms.ProgressBar progressBar1;
private System.Windows.Forms.ImageList imgMesImages;
private CheckBox chkInclu;
private MenuStrip menuStrip1;
private ToolStripMenuItem fichierToolStripMenuItem;
private ToolStripMenuItem affichageToolStripMenuItem;
private ToolStripMenuItem darioPageToolStripMenuItem;
private ToolStripMenuItem personneEnCongéToolStripMenuItem;
private ToolStripMenuItem enregistrerToolStripMenuItem;
private ToolStripMenuItem quitterToolStripMenuItem;
private System.ComponentModel.IContainer components;

public frmExamen()
{
//
// Requis pour la prise en charge du Concepteur Windows Forms
//
InitializeComponent();

//
// TODO : ajoutez le code du constructeur après l'appel à InitializeComponent
//
}

/// <summary>
/// Nettoyage des ressources utilisées.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Code généré par le Concepteur Windows Form
/// <summary>
/// Méthode requise pour la prise en charge du concepteur - ne modifiez pas
/// le contenu de cette méthode avec l'éditeur de code.
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmExamen));
this.lstAffichageDemande = new System.Windows.Forms.ListBox();
this.btnEnvoyer = new System.Windows.Forms.Button();
this.btnQuitter = new System.Windows.Forms.Button();
this.cboPersonnels = new System.Windows.Forms.ComboBox();
this.cboFonctions = new System.Windows.Forms.ComboBox();
this.cboTypesConges = new System.Windows.Forms.ComboBox();
this.lstRefus = new System.Windows.Forms.ListBox();
this.lstAccord = new System.Windows.Forms.ListBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.label4 = new System.Windows.Forms.Label();
this.label1 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.grpDemandeConge = new System.Windows.Forms.GroupBox();
this.chkInclu = new System.Windows.Forms.CheckBox();
this.lblAu = new System.Windows.Forms.Label();
this.dateTimePicker2 = new System.Windows.Forms.DateTimePicker();
this.btnAfficher = new System.Windows.Forms.Button();
this.lblHorloge = new System.Windows.Forms.Label();
this.tmrHeure = new System.Windows.Forms.Timer(this.components);
this.btnMessage = new System.Windows.Forms.Button();
this.grbInfprmations = new System.Windows.Forms.GroupBox();
this.lblAffichageInfos = new System.Windows.Forms.Label();
this.lblY = new System.Windows.Forms.Label();
this.lblX = new System.Windows.Forms.Label();
this.progressBar1 = new System.Windows.Forms.ProgressBar();
this.imgMesImages = new System.Windows.Forms.ImageList(this.components);
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fichierToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.enregistrerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.quitterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.affichageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.darioPageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.personneEnCongéToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.groupBox1.SuspendLayout();
this.grpDemandeConge.SuspendLayout();
this.grbInfprmations.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.SuspendLayout();
//
// lstAffichageDemande
//
this.lstAffichageDemande.Location = new System.Drawing.Point(24, 264);
this.lstAffichageDemande.Name = "lstAffichageDemande";
this.lstAffichageDemande.Size = new System.Drawing.Size(144, 160);
this.lstAffichageDemande.TabIndex = 0;
this.lstAffichageDemande.MouseHover += new System.EventHandler(this.lstAffichageDemande_MouseHover);
this.lstAffichageDemande.MouseLeave += new System.EventHandler(this.lstAffichageDemande_MouseLeave);
//
// btnEnvoyer
//
this.btnEnvoyer.Location = new System.Drawing.Point(384, 56);
this.btnEnvoyer.Name = "btnEnvoyer";
this.btnEnvoyer.Size = new System.Drawing.Size(75, 23);
this.btnEnvoyer.TabIndex = 1;
this.btnEnvoyer.Text = "&Envoyer";
this.btnEnvoyer.MouseLeave += new System.EventHandler(this.btnEnvoyer_MouseLeave);
this.btnEnvoyer.Click += new System.EventHandler(this.btnEnvoyer_Click);
this.btnEnvoyer.MouseMove += new System.Windows.Forms.MouseEventHandler(this.btnEnvoyer_MouseMove);
this.btnEnvoyer.MouseHover += new System.EventHandler(this.btnEnvoyer_MouseHover);
//
// btnQuitter
//
this.btnQuitter.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnQuitter.Location = new System.Drawing.Point(384, 152);
this.btnQuitter.Name = "btnQuitter";
this.btnQuitter.Size = new System.Drawing.Size(75, 23);
this.btnQuitter.TabIndex = 2;
this.btnQuitter.Text = "&Quitter";
this.btnQuitter.MouseLeave += new System.EventHandler(this.btnQuitter_MouseLeave);
this.btnQuitter.Click += new System.EventHandler(this.btnQuitter_Click);
this.btnQuitter.MouseMove += new System.Windows.Forms.MouseEventHandler(this.btnQuitter_MouseMove);
this.btnQuitter.MouseHover += new System.EventHandler(this.btnQuitter_MouseHover);
//
// cboPersonnels
//
this.cboPersonnels.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboPersonnels.Items.AddRange(new object[] {
"",
"ABISSI",
"ALFARO",
"AMEUR",
"BERARDOZZI",
"BOUVY",
"BUIDANE",
"CABU",
"CAMPIONE",
"CAPOBIANCO F",
"CAPOBIANCO M",
"CARRARO",
"CARRETTA",
"CHIODO",
"COLEMONTS",
"DAL PON",
"DELCOURT",
"DELGOMBE",
"DEMOULIN",
"DENIS",
"DEPAS",
"DEVAHIVE",
"EL HOUS",
"GALISTEO",
"GARCIA",
"GEORGES",
"GOMEZ",
"GUGLIANDOLO",
"GUILMOT",
"HAMMOUTI",
"INKALE",
"JEURISSEN",
"KINABLE",
"KORAMAZ",
"LALMAN",
"LAMOUREUX",
"LEBEAU",
"LECCA",
"LEMMENS",
"LIEGEOIS",
"LOMMA",
"MAES",
"MAINGUET",
"MARTELI",
"MATTHYS N",
"MEISE",
"MERCIER",
"MICELI",
"MICKISCH",
"MORENO",
"ORNELIS",
"PANNAYE",
"PARRINELLO",
"PAULUS",
"PINI",
"PIZZARO",
"PLANCHON",
"RASQUIN",
"REMY",
"SMIT",
"SPALLITTA",
"STEE",
"STRACCIALANO",
"SZYPULSKI",
"TALONE D",
"TALONE F",
"VALSECCHI",
"VANDERSMISSEN",
"VINCENT",
"WOJCIKOWSKI",
"WOTRON",
"WOUTERS",
"YILMAZ",
"ZACCARIA"});
this.cboPersonnels.Location = new System.Drawing.Point(28, 76);
this.cboPersonnels.Name = "cboPersonnels";
this.cboPersonnels.Size = new System.Drawing.Size(121, 21);
this.cboPersonnels.Sorted = true;
this.cboPersonnels.TabIndex = 3;
this.cboPersonnels.MouseHover += new System.EventHandler(this.cboPersonnels_MouseHover);
//
// cboFonctions
//
this.cboFonctions.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboFonctions.Items.AddRange(new object[] {
"",
"Contremaitre",
"Coordinateur zone 4",
"Gestionnaire d\'Expedition",
"Logisticien",
"Méthode et Informations",
"Opérateur Patch",
"Opérateur Press",
"Opérateur soudeuse Laser",
"Responsable logistique interne",
"Responsable Press et soudage",
"Technicien Production"});
this.cboFonctions.Location = new System.Drawing.Point(160, 76);
this.cboFonctions.Name = "cboFonctions";
this.cboFonctions.Size = new System.Drawing.Size(176, 21);
this.cboFonctions.Sorted = true;
this.cboFonctions.TabIndex = 4;
this.cboFonctions.MouseHover += new System.EventHandler(this.cboFonctions_MouseHover);
this.cboFonctions.MouseLeave += new System.EventHandler(this.cboFonctions_MouseLeave);
//
// cboTypesConges
//
this.cboTypesConges.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cboTypesConges.Items.AddRange(new object[] {
"",
"Congés pour Employés",
"Credit d\'heures",
"Petit Chômage",
"Récupération d\'heures Supplémentaires",
"Récupération Jours Fériés",
"Vacances annuelles légales"});
this.cboTypesConges.Location = new System.Drawing.Point(16, 51);
this.cboTypesConges.Name = "cboTypesConges";
this.cboTypesConges.Size = new System.Drawing.Size(176, 21);
this.cboTypesConges.Sorted = true;
this.cboTypesConges.TabIndex = 5;
this.cboTypesConges.MouseHover += new System.EventHandler(this.cboTypesConges_MouseHover);
this.cboTypesConges.MouseLeave += new System.EventHandler(this.cboTypesConges_MouseLeave);
//
// lstRefus
//
this.lstRefus.Location = new System.Drawing.Point(180, 356);
this.lstRefus.Name = "lstRefus";
this.lstRefus.Size = new System.Drawing.Size(148, 69);
this.lstRefus.TabIndex = 6;
this.lstRefus.MouseHover += new System.EventHandler(this.lstRefus_MouseHover);
this.lstRefus.MouseLeave += new System.EventHandler(this.lstRefus_MouseLeave);
//
// lstAccord
//
this.lstAccord.Location = new System.Drawing.Point(168, 44);
this.lstAccord.Name = "lstAccord";
this.lstAccord.Size = new System.Drawing.Size(148, 69);
this.lstAccord.TabIndex = 7;
this.lstAccord.MouseHover += new System.EventHandler(this.lstAccord_MouseHover);
this.lstAccord.MouseLeave += new System.EventHandler(this.lstAccord_MouseLeave);
//
// groupBox1
//
this.groupBox1.BackColor = System.Drawing.Color.Transparent;
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label1);
this.groupBox1.Controls.Add(this.lstAccord);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Location = new System.Drawing.Point(12, 220);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(340, 220);
this.groupBox1.TabIndex = 8;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "Résultats";
//
// label4
//
this.label4.Location = new System.Drawing.Point(47, 30);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(60, 16);
this.label4.TabIndex = 2;
this.label4.Text = "Demandes";
//
// label1
//
this.label1.Location = new System.Drawing.Point(220, 117);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(40, 16);
this.label1.TabIndex = 0;
this.label1.Text = "Refus";
//
// label3
//
this.label3.Location = new System.Drawing.Point(220, 30);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(48, 20);
this.label3.TabIndex = 1;
this.label3.Text = "Accords";
//
// dateTimePicker1
//
this.dateTimePicker1.Location = new System.Drawing.Point(28, 132);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.Size = new System.Drawing.Size(176, 20);
this.dateTimePicker1.TabIndex = 9;
this.dateTimePicker1.MouseLeave += new System.EventHandler(this.dateTimePicker1_MouseLeave);
this.dateTimePicker1.MouseHover += new System.EventHandler(this.dateTimePicker1_MouseHover);
//
// grpDemandeConge
//
this.grpDemandeConge.BackColor = System.Drawing.Color.Transparent;
this.grpDemandeConge.Controls.Add(this.chkInclu);
this.grpDemandeConge.Controls.Add(this.lblAu);
this.grpDemandeConge.Controls.Add(this.dateTimePicker2);
this.grpDemandeConge.Controls.Add(this.cboTypesConges);
this.grpDemandeConge.Location = new System.Drawing.Point(12, 52);
this.grpDemandeConge.Name = "grpDemandeConge";
this.grpDemandeConge.Size = new System.Drawing.Size(340, 144);
this.grpDemandeConge.TabIndex = 10;
this.grpDemandeConge.TabStop = false;
this.grpDemandeConge.Text = "Demande de Congé";
//
// chkInclu
//
this.chkInclu.AutoSize = true;
this.chkInclu.Location = new System.Drawing.Point(198, 119);
this.chkInclu.Name = "chkInclu";
this.chkInclu.Size = new System.Drawing.Size(49, 17);
this.chkInclu.TabIndex = 6;
this.chkInclu.Text = "Inclu";
this.chkInclu.UseVisualStyleBackColor = true;
//
// lblAu
//
this.lblAu.Location = new System.Drawing.Point(92, 100);
this.lblAu.Name = "lblAu";
this.lblAu.Size = new System.Drawing.Size(24, 16);
this.lblAu.TabIndex = 1;
this.lblAu.Text = "Au";
//
// dateTimePicker2
//
this.dateTimePicker2.Location = new System.Drawing.Point(16, 116);
this.dateTimePicker2.Name = "dateTimePicker2";
this.dateTimePicker2.Size = new System.Drawing.Size(176, 20);
this.dateTimePicker2.TabIndex = 0;
this.dateTimePicker2.MouseLeave += new System.EventHandler(this.dateTimePicker2_MouseLeave);
this.dateTimePicker2.MouseHover += new System.EventHandler(this.dateTimePicker2_MouseHover);
//
// btnAfficher
//
this.btnAfficher.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnAfficher.Location = new System.Drawing.Point(384, 88);
this.btnAfficher.Name = "btnAfficher";
this.btnAfficher.Size = new System.Drawing.Size(75, 23);
this.btnAfficher.TabIndex = 11;
this.btnAfficher.Text = "&Afficher";
this.btnAfficher.MouseLeave += new System.EventHandler(this.btnAfficher_MouseLeave);
this.btnAfficher.Click += new System.EventHandler(this.btnAfficher_Click);
this.btnAfficher.MouseMove += new System.Windows.Forms.MouseEventHandler(this.btnAfficher_MouseMove);
this.btnAfficher.MouseHover += new System.EventHandler(this.btnAfficher_MouseHover);
//
// lblHorloge
//
this.lblHorloge.AutoSize = true;
this.lblHorloge.BackColor = System.Drawing.Color.Transparent;
this.lblHorloge.Location = new System.Drawing.Point(396, 36);
this.lblHorloge.Name = "lblHorloge";
this.lblHorloge.Size = new System.Drawing.Size(0, 13);
this.lblHorloge.TabIndex = 12;
//
// tmrHeure
//
this.tmrHeure.Enabled = true;
this.tmrHeure.Interval = 1000;
this.tmrHeure.Tick += new System.EventHandler(this.tmrHeure_Tick);
//
// btnMessage
//
this.btnMessage.Location = new System.Drawing.Point(384, 120);
this.btnMessage.Name = "btnMessage";
this.btnMessage.Size = new System.Drawing.Size(75, 23);
this.btnMessage.TabIndex = 13;
this.btnMessage.Text = "Message";
this.btnMessage.MouseLeave += new System.EventHandler(this.btnMessage_MouseLeave);
this.btnMessage.MouseMove += new System.Windows.Forms.MouseEventHandler(this.button1_MouseMove);
this.btnMessage.MouseHover += new System.EventHandler(this.btnMessage_MouseHover);
//
// grbInfprmations
//
this.grbInfprmations.BackColor = System.Drawing.Color.Transparent;
this.grbInfprmations.Controls.Add(this.lblAffichageInfos);
this.grbInfprmations.Location = new System.Drawing.Point(364, 220);
this.grbInfprmations.Name = "grbInfprmations";
this.grbInfprmations.Size = new System.Drawing.Size(116, 196);
this.grbInfprmations.TabIndex = 14;
this.grbInfprmations.TabStop = false;
this.grbInfprmations.Text = "Informations";
//
// lblAffichageInfos
//
this.lblAffichageInfos.Font = new System.Drawing.Font("Lucida Calligraphy", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.lblAffichageInfos.ForeColor = System.Drawing.Color.Blue;
this.lblAffichageInfos.Location = new System.Drawing.Point(12, 24);
this.lblAffichageInfos.Name = "lblAffichageInfos";
this.lblAffichageInfos.Size = new System.Drawing.Size(96, 148);
this.lblAffichageInfos.TabIndex = 2;
//
// lblY
//
this.lblY.BackColor = System.Drawing.Color.Transparent;
this.lblY.Location = new System.Drawing.Point(381, 194);
this.lblY.Name = "lblY";
this.lblY.Size = new System.Drawing.Size(56, 16);
this.lblY.TabIndex = 1;
this.lblY.Text = "Y";
//
// lblX
//
this.lblX.BackColor = System.Drawing.Color.Transparent;
this.lblX.Location = new System.Drawing.Point(381, 178);
this.lblX.Name = "lblX";
this.lblX.Size = new System.Drawing.Size(56, 16);
this.lblX.TabIndex = 0;
this.lblX.Text = "X";
//
// progressBar1
//
this.progressBar1.Enabled = false;
this.progressBar1.Location = new System.Drawing.Point(364, 420);
this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(116, 20);
this.progressBar1.TabIndex = 3;
//
// imgMesImages
//
this.imgMesImages.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imgMesImages.ImageStream")));
this.imgMesImages.TransparentColor = System.Drawing.Color.Transparent;
this.imgMesImages.Images.SetKeyName(0, "");
this.imgMesImages.Images.SetKeyName(1, "");
this.imgMesImages.Images.SetKeyName(2, "");
//
// menuStrip1
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.fichierToolStripMenuItem,
this.affichageToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(484, 24);
this.menuStrip1.TabIndex = 15;
this.menuStrip1.Text = "menuStrip1";
//
// fichierToolStripMenuItem
//
this.fichierToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.enregistrerToolStripMenuItem,
this.quitterToolStripMenuItem});
this.fichierToolStripMenuItem.Name = "fichierToolStripMenuItem";
this.fichierToolStripMenuItem.Size = new System.Drawing.Size(50, 20);
this.fichierToolStripMenuItem.Text = "&Fichier";
//
// enregistrerToolStripMenuItem
//
this.enregistrerToolStripMenuItem.Name = "enregistrerToolStripMenuItem";
this.enregistrerToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E)));
this.enregistrerToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
this.enregistrerToolStripMenuItem.Text = "&Enregistrer";
//
// quitterToolStripMenuItem
//
this.quitterToolStripMenuItem.Name = "quitterToolStripMenuItem";
this.quitterToolStripMenuItem.Size = new System.Drawing.Size(165, 22);
this.quitterToolStripMenuItem.Text = "&Quitter";
//
// affichageToolStripMenuItem
//
this.affichageToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.darioPageToolStripMenuItem,
this.personneEnCongéToolStripMenuItem});
this.affichageToolStripMenuItem.Name = "affichageToolStripMenuItem";
this.affichageToolStripMenuItem.Size = new System.Drawing.Size(65, 20);
this.affichageToolStripMenuItem.Text = "&Affichage";
//
// darioPageToolStripMenuItem
//
this.darioPageToolStripMenuItem.Name = "darioPageToolStripMenuItem";
this.darioPageToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.darioPageToolStripMenuItem.Text = "&Dario Page";
this.darioPageToolStripMenuItem.Click += new System.EventHandler(this.darioPageToolStripMenuItem_Click);
//
// personneEnCongéToolStripMenuItem
//
this.personneEnCongéToolStripMenuItem.Name = "personneEnCongéToolStripMenuItem";
this.personneEnCongéToolStripMenuItem.Size = new System.Drawing.Size(168, 22);
this.personneEnCongéToolStripMenuItem.Text = "&Personnel en congé";
//
// frmExamen
//
this.AcceptButton = this.btnEnvoyer;
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.Color.WhiteSmoke;
this.BackgroundImage = global::Examen1.Properties.Resources.BACKGROUND2;
this.CancelButton = this.btnQuitter;
this.ClientSize = new System.Drawing.Size(484, 446);
this.Controls.Add(this.lblY);
this.Controls.Add(this.progressBar1);
this.Controls.Add(this.grbInfprmations);
this.Controls.Add(this.lblX);
this.Controls.Add(this.btnMessage);
this.Controls.Add(this.lblHorloge);
this.Controls.Add(this.btnAfficher);
this.Controls.Add(this.dateTimePicker1);
this.Controls.Add(this.lstRefus);
this.Controls.Add(this.cboFonctions);
this.Controls.Add(this.cboPersonnels);
this.Controls.Add(this.btnQuitter);
this.Controls.Add(this.btnEnvoyer);
this.Controls.Add(this.lstAffichageDemande);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.grpDemandeConge);
this.Controls.Add(this.menuStrip1);
this.MainMenuStrip = this.menuStrip1;
this.Name = "frmExamen";
this.Text = "Examen1";
this.Load += new System.EventHandler(this.frmExamen_Load);
this.groupBox1.ResumeLayout(false);
this.grpDemandeConge.ResumeLayout(false);
this.grpDemandeConge.PerformLayout();
this.grbInfprmations.ResumeLayout(false);
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();

}
#endregion

/// <summary>
/// Point d'entrée principal de l'application.
/// </summary>
[STAThread]
static void Main()
{
// Application.Run(new frmAutorisation());
Application.Run(new frmExamen());
}
//---------------------------Appel Fonction-------Evite que X,Y & l'info, restent visible dés le demmarage
private void frmExamen_Load(object sender, System.EventArgs e)
{
effacerReference();
lblAffichageInfos.Text=" ";
}
//--------------------------------- FIN ----------------------------------------------------------------------
//---------------------------------------------------------------------------- essaie
private void ajout(object sender)//**un evenement
{
objResponssable.objDemande=this;
}
//------------------------------ FIN -----------------------------------------------------
//--------------------------------------------------------------------------------------Fermer l'application
private void btnQuitter_Click(object sender, System.EventArgs e)
{
this.Close();

}
//-------------------------------------------------------------------------------------Affichage de l'horloge
private void tmrHeure_Tick(object sender, System.EventArgs e)
{
lblHorloge.Text=DateTime.Now.ToLongTimeString();
}
//----------------------------------------------------------------------------Fonction------InitialisePropriété
public void PerformStep()
{
progressBar1.PerformStep();
UpdateLabel();
}
//-------------------------Foction-------ProgressBart.Affiche la progression en décimal dans le boutton Envoyer
private void UpdateLabel()
{
btnEnvoyer.Text = (Math.Round((decimal)(progressBar1.Value * 1000) /
progressBar1.Maximum)).ToString();
btnEnvoyer.Text+= "% Done";
}
//--------------------------------------------------------------------------------------------------fin
string objAjoutePersonne,objAjouteFonction,objAjouteTypeConge; //-----Déclaration des variables globales
//---------------------------------------------------------------------------------------------------------------fin

private void encodage()//---------------------------------------------------------------fonction encodage
{
if((cboPersonnels.SelectedItem !=null) && (cboFonctions.SelectedItem !=null) &&
(cboTypesConges.SelectedItem !=null )) // -------------------------------Condition d'exclusion
{
this.lstAffichageDemande.Items.Add("-----------------------------------------------");
this.lstAffichageDemande.Items.Add(this.cboPersonnels.SelectedItem);
objAjoutePersonne = this.cboPersonnels.SelectedItem.ToString();
this.lstAffichageDemande.Items.Add(this.cboFonctions.SelectedItem);
objAjouteFonction = this.cboFonctions.SelectedItem.ToString();
this.lstAffichageDemande.Items.Add(this.cboTypesConges.SelectedItem);
objAjouteTypeConge = this.cboTypesConges.SelectedItem.ToString();
this.lstAffichageDemande.Items.Add(this.dateTimePicker1.Text).ToString();
/*this.lstAffichageDemande = ("Mr "+(cboPersonnels.SelectedItem.ToString));/* + "a pour fonction " + this.cboFonctions.SelectedItem.ToString +
"demande congé pour le " + this.dateTimePicker1.Text.ToString);*/
if (this.chkInclu.Checked != true)
return;
this.lstAffichageDemande.Items.Add("AU");
this.lstAffichageDemande.Items.Add(this.dateTimePicker2.Text).ToString();
}
else
MessageBox.Show("Tout les Menus doivent être séléctionnés svp", "MESSAGE D'ERREUR");//----Message Renvoyé en cas d'exclusion
ListView objListView = new ListView();
ListViewItem objEncore = new ListViewItem();
objEncore = objListView.listView1.Items.Add(objAjoutePersonne);
objEncore.SubItems.Add(objAjouteFonction);
}

//---------------------------------------- FIN ------------------------------------------------------------------------------------
//------------------------Fonction-------------------------Inter Action------------------Manipulation des données
private void btnEnvoyer_Click(object sender, System.EventArgs e)
{

PerformStep();

//---------------------------------- Création de la progressBar -------------------Vu en Classe
do
{
progressBar1.PerformStep();
Thread.Sleep(300);
}while(progressBar1.Value<progressBar1.Maximum);
progressBar1.Value=progressBar1.Minimum;

encodage();//---appel de la fonction encodage (met les données dans la listeBox (lstAffichageDemande))

//frmResponssable objRes = new frmResponssable();

// objRes.lstDémandes.Text = lstAffichageDemande.ToString();
//objRes.lstDémandes.Text = tB2;


//objResponssable.lstDémandes.Text=f;
/*this.lstAffichageDemande.Items.Add(this.cboPersonnels.SelectedItem);
objAjoutePersonne = this.cboPersonnels.SelectedItem.ToString();
this.lstAffichageDemande.Items.Add(this.cboFonctions.SelectedItem);
objAjouteFonction = this.cboFonctions.SelectedItem.ToString();
this.lstAffichageDemande.Items.Add(this.cboTypesConges.SelectedItem);
objAjouteTypeConge = this.cboTypesConges.SelectedItem.ToString();
this.lstAffichageDemande.Items.Add(this.dateTimePicker1.Text).ToString();
/*this.lstAffichageDemande = ("Mr "+(cboPersonnels.SelectedItem.ToString));/* + "a pour fonction " + this.cboFonctions.SelectedItem.ToString +
"demande congé pour le " + this.dateTimePicker1.Text.ToString);
if (this.chkInclu.Checked != true)
return;
this.lstAffichageDemande.Items.Add("AU");
this.lstAffichageDemande.Items.Add(this.dateTimePicker2.Text).ToString();*/



}
//-------------------------------------------- FIN ---------------------------------------------------------------------------------------------------------------------
//-------------------------------------------Fonction---------Renvoie les valeurs de X & Y de la souris
private void referencePointeur (object sender, System.Windows.Forms.MouseEventArgs e)
{
lblX.Text="X : "+e.X.ToString();
lblY.Text="Y : "+e.Y.ToString();
}
//------------------------------------------- FIN --------------------------------------------------------------------
//--------------------------Fonction--------Remplace le contenu du lbl par un vide
private void effacerReference()
{
lblX.Text=" ";
lblY.Text=" ";
}
//--------------------------------------------- FIN -------------------------------------------------------------------------
//---------------------------------------Fonctions---------Renvoie les valeurs de X & Y de l'objet

private void btnEnvoyer_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.referencePointeur(sender,e);
}
private void btnAfficher_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.referencePointeur(sender,e);
}
private void button1_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.referencePointeur(sender,e);
}
private void btnQuitter_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
this.referencePointeur(sender,e);
}
//------------------------------------------------ FIN -------------------------------------------------------
//------------------------------------------------ Fonction Message Info ---------------------------------------------------
private void btnEnvoyer_MouseHover(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=("Click sur ce boutton pour envoyer ta demade");
UpdateLabel();
}
private void btnAfficher_MouseHover(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=("Click sur ce boutton pour faire apparaître le tableau de demandes");
}
private void btnQuitter_MouseHover(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=("Click sur ce boutton pour quitter l'application");
}
private void lstRefus_MouseHover(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=("Affiche toutes les demandes refusées");
}
private void lstAccord_MouseHover(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=("Affiche toutes les demandes acceptées");
}
private void lstAffichageDemande_MouseHover(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=("Listes de demandes");
}
private void cboPersonnels_MouseHover(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=("Affiche la liste du personnels");
}
private void cboFonctions_MouseHover(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=("Affiche la liste des fonctions");
}
private void dateTimePicker2_MouseHover(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=("Pour des congés comprisent entre deux dates");
}
private void dateTimePicker1_MouseHover(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=("Séléctionner la date de congé");
}
private void cboTypesConges_MouseHover(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=("Affiche la liste de congé (type)");
}
private void btnMessage_MouseHover(object sender, EventArgs e)
{
lblAffichageInfos.Text = ("Laisser un message à votre responssable pour affiner votre démande.");
}
//------------------------------------------------ FIN ---------------------------------------------------------------------------------Fonction------Efface l'info sur l'objet
private void lstAffichageDemande_MouseLeave(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=" ";
}
private void btnEnvoyer_MouseLeave(object sender, System.EventArgs e)
{
btnEnvoyer.Text= "Envoyer";//-------------------------------------- Remet le mot "Envoyer"
}
private void btnQuitter_MouseLeave(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=" ";
}
private void btnAfficher_MouseLeave(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=" ";
}
private void lstRefus_MouseLeave(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=" ";
}
private void lstAccord_MouseLeave(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=" ";
}
private void cboFonctions_MouseLeave(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=" ";
}
private void cboTypesConges_MouseLeave(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=" ";
}
private void dateTimePicker1_MouseLeave(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=" ";
}
private void dateTimePicker2_MouseLeave(object sender, System.EventArgs e)
{
lblAffichageInfos.Text=" ";
}
private void btnMessage_MouseLeave(object sender, EventArgs e)
{
lblAffichageInfos.Text = " ";
}
private void btnAfficher_Click(object sender, System.EventArgs e)
{
ListView objListView=new ListView();
objListView.ShowDialog();
}
//-------------------------------------------- Essaie -------------------------------------------------------------

private void darioPageToolStripMenuItem_Click(object sender, EventArgs e)
{
frmAutorisation objAutorisation = new frmAutorisation();
objAutorisation.Show();
}
}
}


et voici la deuxieme form (frmResponssable)

namespace Examen1
{
partial class frmResponssable
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;

/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows Form Designer generated code

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.btnAccord = new System.Windows.Forms.Button();
this.btnAnnuler = new System.Windows.Forms.Button();
this.grbTraitement = new System.Windows.Forms.GroupBox();
this.lstEnRepos = new System.Windows.Forms.ListBox();
this.lstRefus = new System.Windows.Forms.ListBox();
this.lstAccords = new System.Windows.Forms.ListBox();
this.lstDémandes = new System.Windows.Forms.ListBox();
this.lblRefus = new System.Windows.Forms.Label();
this.lblDemandes = new System.Windows.Forms.Label();
this.lblAccords = new System.Windows.Forms.Label();
this.lblEnRepos = new System.Windows.Forms.Label();
this.btnRefus = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.btnSupprimer = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.grbTraitement.SuspendLayout();
this.SuspendLayout();
//
// btnAccord
//
this.btnAccord.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnAccord.Location = new System.Drawing.Point(613, 190);
this.btnAccord.Name = "btnAccord";
this.btnAccord.Size = new System.Drawing.Size(73, 23);
this.btnAccord.TabIndex = 2;
this.btnAccord.Text = "Accord";
this.btnAccord.UseVisualStyleBackColor = true;
this.btnAccord.Click += new System.EventHandler(this.btnOk_Click);
//
// btnAnnuler
//
this.btnAnnuler.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnAnnuler.Location = new System.Drawing.Point(613, 306);
this.btnAnnuler.Name = "btnAnnuler";
this.btnAnnuler.Size = new System.Drawing.Size(73, 23);
this.btnAnnuler.TabIndex = 3;
this.btnAnnuler.Text = "Quitter";
this.btnAnnuler.UseVisualStyleBackColor = true;
//
// grbTraitement
//
this.grbTraitement.Controls.Add(this.lstEnRepos);
this.grbTraitement.Controls.Add(this.lstRefus);
this.grbTraitement.Controls.Add(this.lstAccords);
this.grbTraitement.Controls.Add(this.lstDémandes);
this.grbTraitement.Controls.Add(this.lblRefus);
this.grbTraitement.Controls.Add(this.lblDemandes);
this.grbTraitement.Controls.Add(this.lblAccords);
this.grbTraitement.Controls.Add(this.lblEnRepos);
this.grbTraitement.Location = new System.Drawing.Point(12, 102);
this.grbTraitement.Name = "grbTraitement";
this.grbTraitement.Size = new System.Drawing.Size(595, 344);
this.grbTraitement.TabIndex = 7;
this.grbTraitement.TabStop = false;
this.grbTraitement.Text = "Traitement des Demandes";
//
// lstEnRepos
//
this.lstEnRepos.FormattingEnabled = true;
this.lstEnRepos.Location = new System.Drawing.Point(413, 45);
this.lstEnRepos.Name = "lstEnRepos";
this.lstEnRepos.Size = new System.Drawing.Size(174, 290);
this.lstEnRepos.TabIndex = 6;
//
// lstRefus
//
this.lstRefus.FormattingEnabled = true;
this.lstRefus.Location = new System.Drawing.Point(211, 201);
this.lstRefus.Name = "lstRefus";
this.lstRefus.Size = new System.Drawing.Size(196, 134);
this.lstRefus.TabIndex = 5;
//
// lstAccords
//
this.lstAccords.FormattingEnabled = true;
this.lstAccords.Location = new System.Drawing.Point(211, 45);
this.lstAccords.Name = "lstAccords";
this.lstAccords.Size = new System.Drawing.Size(196, 134);
this.lstAccords.TabIndex = 1;
//
// lstDémandes
//
this.lstDémandes.FormattingEnabled = true;
this.lstDémandes.Location = new System.Drawing.Point(6, 45);
this.lstDémandes.Name = "lstDémandes";
this.lstDémandes.Size = new System.Drawing.Size(199, 290);
this.lstDémandes.TabIndex = 0;
//
// lblRefus
//
this.lblRefus.AutoSize = true;
this.lblRefus.Location = new System.Drawing.Point(292, 185);
this.lblRefus.Name = "lblRefus";
this.lblRefus.Size = new System.Drawing.Size(35, 13);
this.lblRefus.TabIndex = 10;
this.lblRefus.Text = "Refus";
//
// lblDemandes
//
this.lblDemandes.AutoSize = true;
this.lblDemandes.Location = new System.Drawing.Point(80, 29);
this.lblDemandes.Name = "lblDemandes";
this.lblDemandes.Size = new System.Drawing.Size(58, 13);
this.lblDemandes.TabIndex = 11;
this.lblDemandes.Text = "Demandes";
//
// lblAccords
//
this.lblAccords.AutoSize = true;
this.lblAccords.Location = new System.Drawing.Point(292, 29);
this.lblAccords.Name = "lblAccords";
this.lblAccords.Size = new System.Drawing.Size(46, 13);
this.lblAccords.TabIndex = 12;
this.lblAccords.Text = "Accords";
//
// lblEnRepos
//
this.lblEnRepos.AutoSize = true;
this.lblEnRepos.Location = new System.Drawing.Point(478, 29);
this.lblEnRepos.Name = "lblEnRepos";
this.lblEnRepos.Size = new System.Drawing.Size(54, 13);
this.lblEnRepos.TabIndex = 13;
this.lblEnRepos.Text = "En Repos";
//
// btnRefus
//
this.btnRefus.Location = new System.Drawing.Point(613, 248);
this.btnRefus.Name = "btnRefus";
this.btnRefus.Size = new System.Drawing.Size(73, 23);
this.btnRefus.TabIndex = 4;
this.btnRefus.Text = "Refus";
this.btnRefus.UseVisualStyleBackColor = true;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(41, 50);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(382, 20);
this.textBox1.TabIndex = 5;
//
// btnSupprimer
//
this.btnSupprimer.Location = new System.Drawing.Point(613, 277);
this.btnSupprimer.Name = "btnSupprimer";
this.btnSupprimer.Size = new System.Drawing.Size(73, 23);
this.btnSupprimer.TabIndex = 8;
this.btnSupprimer.Text = "Supprimer";
this.btnSupprimer.UseVisualStyleBackColor = true;
//
// button1
//
this.button1.Location = new System.Drawing.Point(613, 219);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(73, 23);
this.button1.TabIndex = 9;
this.button1.Text = "Accord.S.R";
this.button1.UseVisualStyleBackColor = true;
//
// frmResponssable
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(693, 458);
this.Controls.Add(this.button1);
this.Controls.Add(this.btnSupprimer);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.grbTraitement);
this.Controls.Add(this.btnRefus);
this.Controls.Add(this.btnAnnuler);
this.Controls.Add(this.btnAccord);
this.Name = "frmResponssable";
this.Text = "Responssable";
this.grbTraitement.ResumeLayout(false);
this.grbTraitement.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.Button btnAccord;
private System.Windows.Forms.Button btnAnnuler;
private System.Windows.Forms.GroupBox grbTraitement;
private System.Windows.Forms.ListBox lstAccords;
public System.Windows.Forms.ListBox lstDémandes;//----liste ou doit atterir les données
frmExamen objMyExamen; //--------------------------------------------------------Essaie
private System.Windows.Forms.Button btnRefus;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.ListBox lstRefus;
private System.Windows.Forms.ListBox lstEnRepos;
private System.Windows.Forms.Button btnSupprimer;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label lblRefus;
private System.Windows.Forms.Label lblDemandes;
private System.Windows.Forms.Label lblAccords;
private System.Windows.Forms.Label lblEnRepos;
//----------------------------------------------------------------------------------------Essaie
public frmExamen objDemande
{
get { return objMyExamen; }
set { objMyExamen = value;}
}
//------------------------------------------------ ------------------------------------------FIN

}

}

j'ai mis des commentaires afin de mieux vous guider
voila mais vraiment en espérant une fois de plus ne pas trop abuser de votre tmp
merci encore
0
Milliardo Messages postés 5 Statut Membre
 
merci a toi
0
kis80
 
Salut!
Je n'ai pas pu executer ton code car j'ai Net2005
Mais j'ai fait un truc de ton genre compatible pour les 2 versions
Je cree 2 winform :
*form1 ou il y a lstbox(public) et un bouton charge form2
*form2 ou il y alstbox et un bouton envoyer les items de la listbox ver lstbox de la form1
//**Code pour form1*****
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CMM
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)//***evenement clic
{
Form2 frm = new Form2();
frm.maform1 = this;
frm.Show();
}
}
}
//***Code pour fom2
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace CMM
{
public partial class Form2 : Form
{
Form1 MyForm1;
public Form2()
{
InitializeComponent();
}
public Form1 maform1//**propriete de type form1
{
get { return MyForm1; }
set { MyForm1 = value; }
}

private void button1_Click(object sender, EventArgs e)
{
for(int i=0;i<listBox1.Items.Count;i++)
MyForm1.listBox1.Items.Add(listBox1.Items[i]);
}

}
}
0
Milliardo Messages postés 5 Statut Membre
 
ahhahahah cooooooooool voila ca marche sans probleme mais tu sais bien il y a tjs un mais.....
j'ai un peu changé ton code pas grand chose car dans mon projet il est primordial que les données transitent de la form1 vers la form2,tu vas me dire oui il suffit dinverser...lol mais le probleme se situt à ce niveau:

private void button1_Click(object sender, EventArgs e)//***evenement clic
{
Form1 frm = new Form1();
frm.maform2 = this;
frm.Show();
}

si j'envoie les données directement de form1 à form2 il y à rien qui se passe parcontre je suis tjs obligé d'ouvrir form1 appartir de form2 puis telecharger les données
ce que je voudrai c'est simplement envoyer les data de la lstbox1 de form1 vers form2(listbox2)sans etre obligé d'ouvrir la form2 pour la manipulation

PS : je tien à metre ton nom ou ron pseudo a ma page de remerciment bien suer si tu ne vois pas d'inconvenient (c'est la moindre de chose) Merci à toi ;)
0
kis80 > Milliardo Messages postés 5 Statut Membre
 
avec rezon car tout sera reintialisé
Dans ce cas declare une arraylist public global dans form1 qui te permettra de remplir ta listbox dans le load

//***Form1
public arraylist arrlist =new arraylist();
en load de form1
lstbox.datasource=arrlist;
//**form2
private void button1_Click(object sender, EventArgs e)
{
for(int i=0;i<listBox1.Items.Count;i++)
MyForm1.arrlist.Add(listBox1.Items[i]);
}
0