IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

C# Discussion :

Probleme de Winform


Sujet :

C#

  1. #1
    Membre habitué
    Inscrit en
    Avril 2007
    Messages
    11
    Détails du profil
    Informations forums :
    Inscription : Avril 2007
    Messages : 11
    Par défaut Probleme de Winform
    Bonjour a tous,
    je suis débutant sur C#, j'utilise Visual Studio 2008, donc j'ai décider de débuter avec les winform avant les WPF.
    Mais la je suis plus que coincer. En fait, dans mon application, j'ai cree 2 objets winform. Je veux que par le clic du bouton ouvrir, la 2eme fenêtre s'ouvre.
    le clic sur le bouton "ouvrir", appel une 2eme fenetre que j'ai cree precedement au sein de la meme application.
    j'ai tenter ceci sur l'evenement Onclick du bouton :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    Form2 frm = new Form2();
    form2.ShowDialog();  //Form2 etant le nom du 2eme formulaire que j'avais cree
    mais cela m'ouvre une fenetre vierge, pas la 2eme que j'avais cree auparavant, alors je me demande bien quel methode je dois appliquer ?

    Besoin d'aide svp.

    Merci.

    Prince

  2. #2
    Membre éclairé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2009
    Messages
    338
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2009
    Messages : 338
    Par défaut
    Essai plutôt comme ça :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    Form2 frm = new Form2();
    frm.ShowDialog();

  3. #3
    Membre habitué
    Inscrit en
    Avril 2007
    Messages
    11
    Détails du profil
    Informations forums :
    Inscription : Avril 2007
    Messages : 11
    Par défaut
    merci pour ta réponse,
    Voici le code du bouton "ouvrir" du 1er formulaire, "essai" étant le nom du 2em form, mais rien n'.y s'y passe, il me présente toujours un nouveau formulaire vierge au lieu de faire appel au form "essai"

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    private void button4_Click_1(object sender, EventArgs e)
            {
                essai frm = new essai();
                frm.ShowDialog();
     
            }

  4. #4
    Membre éclairé
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juillet 2009
    Messages
    338
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 53
    Localisation : France, Pas de Calais (Nord Pas de Calais)

    Informations professionnelles :
    Activité : Développeur informatique

    Informations forums :
    Inscription : Juillet 2009
    Messages : 338
    Par défaut
    en tout cas, le code de ton bouton est correct

  5. #5
    Membre habitué
    Inscrit en
    Avril 2007
    Messages
    11
    Détails du profil
    Informations forums :
    Inscription : Avril 2007
    Messages : 11
    Par défaut
    il n y a t'il pas une astuce ou bien une manipulation qui manque pour l'autre form s'affiche tel que je l'ai crée ?

    Merci

  6. #6
    Expert confirmé Avatar de Graffito
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    5 993
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 5 993
    Par défaut
    Est-ce que la propriété "Visible" des Controls de la form sont à true ?

  7. #7
    Membre éclairé
    Inscrit en
    Juillet 2010
    Messages
    292
    Détails du profil
    Informations personnelles :
    Âge : 38

    Informations forums :
    Inscription : Juillet 2010
    Messages : 292
    Par défaut
    Tu peux pas faire ça :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    LaFormQueTuVeuxOuvrir.Show();
    T'as les méthodes Show() et Close() qui te permettent d'ouvrir et de fermer les Windows Form que tu souhaites.

  8. #8
    Membre émérite
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Juillet 2007
    Messages
    693
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Consultant informatique

    Informations forums :
    Inscription : Juillet 2007
    Messages : 693
    Par défaut
    Bonjour,

    Peux-tu nous montrer le design de ta form essai, ainsi que le code du .cs et du .Design.cs (juste le début des deux fichiers là où il y a public class essai et partial class essai : Form) ?

  9. #9
    Membre averti
    Inscrit en
    Avril 2008
    Messages
    33
    Détails du profil
    Informations forums :
    Inscription : Avril 2008
    Messages : 33
    Par défaut
    il ne faut pas utiliser .close() sinon toute l'application se ferme, utilises plutot .hide() (normalement c'est ça, j'ai oublié depuis le temps, sinon tu mets .visible=false)
    et puis tu utilises le .show() comme a dit juju precedemment

    ça te fera un truc du genre

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
           formeActuelle.hide();
           formeAafficher.show();

  10. #10
    Membre habitué
    Inscrit en
    Avril 2007
    Messages
    11
    Détails du profil
    Informations forums :
    Inscription : Avril 2007
    Messages : 11
    Par défaut
    Bonjour,

    Pour donner suite a votre demande, je colle le code que j'ai produit

    Voici les codes :

    la 1ere fenetre, celle qui va appeler l'autre :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
     
     
    namespace inser_matiere
    {
        public partial class aj_matiere : Form
        {
            public aj_matiere()
            {
                InitializeComponent();
            }
     
         private void button4_Click_1(object sender, EventArgs e)
            {
                essai f2 = new essai();
                f2.ShowDialog();
              }
     
            private void button3_Click(object sender, EventArgs e)
            {
                aj_matiere.ActiveForm.Close();
            }
        }
    }

    le fichier Designer.cs du 1er formulaire :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    namespace inser_matiere
    {
        partial class aj_matiere
        {
            /// <summary>
            /// Variable nécessaire au concepteur.
            /// </summary>
            private System.ComponentModel.IContainer components = null;
     
            /// <summary>
            /// Nettoyage des ressources utilisées.
            /// </summary>
            /// <param name="disposing">true si les ressources managées doivent être supprimées*; sinon, false.</param>
            protected override void Dispose(bool disposing)
            {
                if (disposing && (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(aj_matiere));
                this.label1 = new System.Windows.Forms.Label();
                this.label2 = new System.Windows.Forms.Label();
                this.label3 = new System.Windows.Forms.Label();
                this.label4 = new System.Windows.Forms.Label();
                this.code_mat = new System.Windows.Forms.TextBox();
                this.nom_mat = new System.Windows.Forms.TextBox();
                this.coef_mat = new System.Windows.Forms.TextBox();
                this.groupBox1 = new System.Windows.Forms.GroupBox();
                this.button1 = new System.Windows.Forms.Button();
                this.button2 = new System.Windows.Forms.Button();
                this.button3 = new System.Windows.Forms.Button();
                this.groupBox2 = new System.Windows.Forms.GroupBox();
                this.dataGridView1 = new System.Windows.Forms.DataGridView();
                this.codematDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.libmatDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.coefmatDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.matiereBindingSource1 = new System.Windows.Forms.BindingSource(this.components);
                this.matiereBindingSource = new System.Windows.Forms.BindingSource(this.components);
                this.button4 = new System.Windows.Forms.Button();
                ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
                ((System.ComponentModel.ISupportInitialize)(this.matiereBindingSource1)).BeginInit();
                ((System.ComponentModel.ISupportInitialize)(this.matiereBindingSource)).BeginInit();
                this.SuspendLayout();
                // 
                // label1
                // 
                resources.ApplyResources(this.label1, "label1");
                this.label1.BackColor = System.Drawing.SystemColors.ButtonShadow;
                this.label1.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
                this.label1.Name = "label1";
                // 
                // label2
                // 
                resources.ApplyResources(this.label2, "label2");
                this.label2.Name = "label2";
                // 
                // label3
                // 
                resources.ApplyResources(this.label3, "label3");
                this.label3.Name = "label3";
                // 
                // label4
                // 
                resources.ApplyResources(this.label4, "label4");
                this.label4.Name = "label4";
                // 
                // code_mat
                // 
                resources.ApplyResources(this.code_mat, "code_mat");
                this.code_mat.Name = "code_mat";
                // 
                // nom_mat
                // 
                resources.ApplyResources(this.nom_mat, "nom_mat");
                this.nom_mat.Name = "nom_mat";
                // 
                // coef_mat
                // 
                resources.ApplyResources(this.coef_mat, "coef_mat");
                this.coef_mat.Name = "coef_mat";
                // 
                // groupBox1
                // 
                resources.ApplyResources(this.groupBox1, "groupBox1");
                this.groupBox1.Name = "groupBox1";
                this.groupBox1.TabStop = false;
                // 
                // button1
                // 
                resources.ApplyResources(this.button1, "button1");
                this.button1.Name = "button1";
                this.button1.UseVisualStyleBackColor = true;
                this.button1.Click += new System.EventHandler(this.button1_Click);
                // 
                // button2
                // 
                resources.ApplyResources(this.button2, "button2");
                this.button2.Name = "button2";
                this.button2.UseVisualStyleBackColor = true;
                this.button2.Click += new System.EventHandler(this.button2_Click);
                // 
                // button3
                // 
                resources.ApplyResources(this.button3, "button3");
                this.button3.Name = "button3";
                this.button3.UseVisualStyleBackColor = true;
                this.button3.Click += new System.EventHandler(this.button3_Click);
                // 
                // groupBox2
                // 
                resources.ApplyResources(this.groupBox2, "groupBox2");
                this.groupBox2.Name = "groupBox2";
                this.groupBox2.TabStop = false;
                // 
                // dataGridView1
                // 
                this.dataGridView1.AllowUserToAddRows = false;
                this.dataGridView1.AllowUserToDeleteRows = false;
                this.dataGridView1.AllowUserToOrderColumns = true;
                this.dataGridView1.AutoGenerateColumns = false;
                this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
                this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
                this.codematDataGridViewTextBoxColumn,
                this.libmatDataGridViewTextBoxColumn,
                this.coefmatDataGridViewTextBoxColumn});
                this.dataGridView1.DataSource = this.matiereBindingSource1;
                resources.ApplyResources(this.dataGridView1, "dataGridView1");
                this.dataGridView1.Name = "dataGridView1";
                this.dataGridView1.ReadOnly = true;
                // 
                // codematDataGridViewTextBoxColumn
                // 
                this.codematDataGridViewTextBoxColumn.DataPropertyName = "code_mat";
                resources.ApplyResources(this.codematDataGridViewTextBoxColumn, "codematDataGridViewTextBoxColumn");
                this.codematDataGridViewTextBoxColumn.Name = "codematDataGridViewTextBoxColumn";
                this.codematDataGridViewTextBoxColumn.ReadOnly = true;
                // 
                // libmatDataGridViewTextBoxColumn
                // 
                this.libmatDataGridViewTextBoxColumn.DataPropertyName = "lib_mat";
                resources.ApplyResources(this.libmatDataGridViewTextBoxColumn, "libmatDataGridViewTextBoxColumn");
                this.libmatDataGridViewTextBoxColumn.Name = "libmatDataGridViewTextBoxColumn";
                this.libmatDataGridViewTextBoxColumn.ReadOnly = true;
                // 
                // coefmatDataGridViewTextBoxColumn
                // 
                this.coefmatDataGridViewTextBoxColumn.DataPropertyName = "coef_mat";
                resources.ApplyResources(this.coefmatDataGridViewTextBoxColumn, "coefmatDataGridViewTextBoxColumn");
                this.coefmatDataGridViewTextBoxColumn.Name = "coefmatDataGridViewTextBoxColumn";
                this.coefmatDataGridViewTextBoxColumn.ReadOnly = true;
                // 
                // matiereBindingSource1
                // 
                this.matiereBindingSource1.DataSource = typeof(inser_matiere.matiere);
                // 
                // matiereBindingSource
                // 
                this.matiereBindingSource.DataSource = typeof(inser_matiere.matiere);
                // 
                // button4
                // 
                resources.ApplyResources(this.button4, "button4");
                this.button4.Name = "button4";
                this.button4.UseVisualStyleBackColor = true;
                this.button4.Click += new System.EventHandler(this.button4_Click_1);
                // 
                // aj_matiere
                // 
                resources.ApplyResources(this, "$this");
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.BackColor = System.Drawing.SystemColors.ActiveCaption;
                this.Controls.Add(this.button4);
                this.Controls.Add(this.dataGridView1);
                this.Controls.Add(this.button3);
                this.Controls.Add(this.button2);
                this.Controls.Add(this.button1);
                this.Controls.Add(this.coef_mat);
                this.Controls.Add(this.nom_mat);
                this.Controls.Add(this.code_mat);
                this.Controls.Add(this.label4);
                this.Controls.Add(this.label3);
                this.Controls.Add(this.label2);
                this.Controls.Add(this.label1);
                this.Controls.Add(this.groupBox1);
                this.Controls.Add(this.groupBox2);
                this.Name = "aj_matiere";
                this.Load += new System.EventHandler(this.aj_matiere_Load);
                ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
                ((System.ComponentModel.ISupportInitialize)(this.matiereBindingSource1)).EndInit();
                ((System.ComponentModel.ISupportInitialize)(this.matiereBindingSource)).EndInit();
                this.ResumeLayout(false);
                this.PerformLayout();
     
            }
     
            #endregion
     
            private System.Windows.Forms.Label label1;
            private System.Windows.Forms.Label label2;
            private System.Windows.Forms.Label label3;
            private System.Windows.Forms.Label label4;
            private System.Windows.Forms.TextBox code_mat;
            private System.Windows.Forms.TextBox nom_mat;
            private System.Windows.Forms.TextBox coef_mat;
            private System.Windows.Forms.GroupBox groupBox1;
            private System.Windows.Forms.Button button1;
            private System.Windows.Forms.Button button2;
            private System.Windows.Forms.Button button3;
            private System.Windows.Forms.GroupBox groupBox2;
            private System.Windows.Forms.DataGridView dataGridView1;
            private System.Windows.Forms.DataGridViewTextBoxColumn codematDataGridViewTextBoxColumn;
            private System.Windows.Forms.DataGridViewTextBoxColumn libmatDataGridViewTextBoxColumn;
            private System.Windows.Forms.DataGridViewTextBoxColumn coefmatDataGridViewTextBoxColumn;
            private System.Windows.Forms.BindingSource matiereBindingSource;
            private System.Windows.Forms.Button button4;
            private System.Windows.Forms.BindingSource matiereBindingSource1;
        }
    }
    le code de la 2em fenetre, celle qui se fait appeler :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
     
    namespace inser_matiere
    {
        public partial class essai : Form 
        {
            public essai()
            {
                //InitializeComponent();
            }
     
            private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
            {
     
            }
     
            private void essai_Load(object sender, EventArgs e)
            {
     
            }
        }
    }

    le fichier designer.cs du 2em formulaire :


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    namespace inser_matiere
    {
        partial class essai
        {
            /// <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.components = new System.ComponentModel.Container();
                this.label1 = new System.Windows.Forms.Label();
                this.dataGridView1 = new System.Windows.Forms.DataGridView();
                this.codematDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.libmatDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.coefmatDataGridViewTextBoxColumn = new System.Windows.Forms.DataGridViewTextBoxColumn();
                this.matiereBindingSource = new System.Windows.Forms.BindingSource(this.components);
                ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit();
                ((System.ComponentModel.ISupportInitialize)(this.matiereBindingSource)).BeginInit();
                this.SuspendLayout();
                // 
                // label1
                // 
                this.label1.AutoSize = true;
                this.label1.Font = new System.Drawing.Font("LetterOMatic!", 15.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                this.label1.Location = new System.Drawing.Point(84, 9);
                this.label1.Name = "label1";
                this.label1.Size = new System.Drawing.Size(296, 25);
                this.label1.TabIndex = 0;
                this.label1.Text = "recuperer les data";
                // 
                // dataGridView1
                // 
                this.dataGridView1.AllowUserToAddRows = false;
                this.dataGridView1.AllowUserToDeleteRows = false;
                this.dataGridView1.AllowUserToOrderColumns = true;
                this.dataGridView1.AutoGenerateColumns = false;
                this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
                this.dataGridView1.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
                this.codematDataGridViewTextBoxColumn,
                this.libmatDataGridViewTextBoxColumn,
                this.coefmatDataGridViewTextBoxColumn});
                this.dataGridView1.DataSource = this.matiereBindingSource;
                this.dataGridView1.Location = new System.Drawing.Point(39, 70);
                this.dataGridView1.Name = "dataGridView1";
                this.dataGridView1.ReadOnly = true;
                this.dataGridView1.Size = new System.Drawing.Size(377, 224);
                this.dataGridView1.TabIndex = 2;
                this.dataGridView1.CellContentClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dataGridView1_CellContentClick);
                // 
                // codematDataGridViewTextBoxColumn
                // 
                this.codematDataGridViewTextBoxColumn.DataPropertyName = "code_mat";
                this.codematDataGridViewTextBoxColumn.HeaderText = "code_mat";
                this.codematDataGridViewTextBoxColumn.Name = "codematDataGridViewTextBoxColumn";
                this.codematDataGridViewTextBoxColumn.ReadOnly = true;
                // 
                // libmatDataGridViewTextBoxColumn
                // 
                this.libmatDataGridViewTextBoxColumn.DataPropertyName = "lib_mat";
                this.libmatDataGridViewTextBoxColumn.HeaderText = "lib_mat";
                this.libmatDataGridViewTextBoxColumn.Name = "libmatDataGridViewTextBoxColumn";
                this.libmatDataGridViewTextBoxColumn.ReadOnly = true;
                // 
                // coefmatDataGridViewTextBoxColumn
                // 
                this.coefmatDataGridViewTextBoxColumn.DataPropertyName = "coef_mat";
                this.coefmatDataGridViewTextBoxColumn.HeaderText = "coef_mat";
                this.coefmatDataGridViewTextBoxColumn.Name = "coefmatDataGridViewTextBoxColumn";
                this.coefmatDataGridViewTextBoxColumn.ReadOnly = true;
                // 
                // matiereBindingSource
                // 
                this.matiereBindingSource.DataSource = typeof(inser_matiere.matiere);
                // 
                // essai
                // 
                this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
                this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
                this.ClientSize = new System.Drawing.Size(459, 395);
                this.Controls.Add(this.dataGridView1);
                this.Controls.Add(this.label1);
                this.Name = "essai";
                this.Text = "essai";
                this.Load += new System.EventHandler(this.essai_Load);
                ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit();
                ((System.ComponentModel.ISupportInitialize)(this.matiereBindingSource)).EndInit();
                this.ResumeLayout(false);
                this.PerformLayout();
     
            }
     
            #endregion
     
            private System.Windows.Forms.Label label1;
            private System.Windows.Forms.DataGridView dataGridView1;
            private System.Windows.Forms.DataGridViewTextBoxColumn codematDataGridViewTextBoxColumn;
            private System.Windows.Forms.DataGridViewTextBoxColumn libmatDataGridViewTextBoxColumn;
            private System.Windows.Forms.DataGridViewTextBoxColumn coefmatDataGridViewTextBoxColumn;
            private System.Windows.Forms.BindingSource matiereBindingSource;
        }
    }

    Je sais que c'est d'une infime partie du code que vous avez besoin, mais j'ai préférer tout afficher au cas ou peut être l'erreur se trouverait autre part.

    merci infiniment

  11. #11
    Membre habitué
    Inscrit en
    Avril 2007
    Messages
    11
    Détails du profil
    Informations forums :
    Inscription : Avril 2007
    Messages : 11
    Par défaut
    Le show() et le close() ne fonctionne pas,
    donc

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    nom_du_formulaire.show();
    ne colle pas, j'utilise l'inteliisense donc après avoir saisi le nom du formulaire a ouvrir, quand je met le point, une liste apparaît mais la méthode Show() ou Close() ne s'y trouve pas.

    Mais ces méthodes existe si je fais :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    nom_du_formulaire.ActiveForm.Show();
    mais n'a aucun effet lorsque que je clique, je ne sais pas s'il faut j'essai des projets avec .Net Framework 3.0 au lieu du 3.5

  12. #12
    Membre émérite
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Juillet 2007
    Messages
    693
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Consultant informatique

    Informations forums :
    Inscription : Juillet 2007
    Messages : 693
    Par défaut
    J'ai trouvé !! Enfin a priori !

    Tu as fait quelque chose de mal vraiment pas bien ! On va te punir pour ça !

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    public essai()
    {
    //InitializeComponent();
    }
    C'est mal de commenter le InitializeComponent ! Alors enlève ces deux // et ce sera régler !

    Sinon le reste du code j'ai rien vu.

    Edit : pour comprendre ce que je dis, regarde tout ce qui est fait dans le InitializeComponent, n'hésite pas à voir et étudier le but de chaque ligne pour chaque contrôle, composant, ... en t'aidant de MSDN. Car il est conseillé par MS de ne pas toucher au contenu de cette méthode, mais il n'est pas dit qu'il ne faut pas comprendre ce qui y est fait !

  13. #13
    Membre habitué
    Inscrit en
    Avril 2007
    Messages
    11
    Détails du profil
    Informations forums :
    Inscription : Avril 2007
    Messages : 11
    Par défaut
    Merci du fond du coeur,

    c’était bel et bien l'erreur, j'avais commis l'erreur de mettre en commentaire. En tout cas je mérite une punition exemplaire comme l'as dit ''ostenhard'', ça marche a merveille.

    Merci beaucoup de votre aide, merci encore.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. probleme de winform appeler une seconde fois.
    Par eldrad95 dans le forum C#
    Réponses: 6
    Dernier message: 08/11/2009, 09h46
  2. Probleme utilisation Winform VS2005
    Par fab039 dans le forum C++/CLI
    Réponses: 2
    Dernier message: 05/03/2008, 13h22
  3. [WinForms]probleme de checkbox flouter
    Par moniteur dans le forum Général Dotnet
    Réponses: 2
    Dernier message: 21/08/2006, 18h43
  4. [WinForms]Probleme d'impression help !
    Par fatflex dans le forum Général Dotnet
    Réponses: 2
    Dernier message: 05/07/2006, 15h03
  5. [WinForms]probleme affichage lors d'un traitement
    Par Rankyboy dans le forum Général Dotnet
    Réponses: 2
    Dernier message: 15/06/2006, 14h13

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo