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 :

créer une nouvelle instance panel dynamique


Sujet :

C#

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre confirmé
    Inscrit en
    Septembre 2008
    Messages
    230
    Détails du profil
    Informations forums :
    Inscription : Septembre 2008
    Messages : 230
    Par défaut créer une nouvelle instance panel dynamique
    Bonjour,

    J'ai une form de base nomé offre et je créer une instance de ma form offre qui reprend les donnée de ma form . Ensuite je peux rajouter des données dans la nouvelle instance . Maintenant j'aimerais créer une nouvelle instance de mon nouveau panel créer et je vois pas comment faire vu que c'est en dynamique .

    Merci de votre coup de pouce .

    Stéphanie

  2. #2
    Membre expérimenté
    Profil pro
    Inscrit en
    Août 2010
    Messages
    164
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Août 2010
    Messages : 164
    Par défaut
    Bonjour,

    essaye un truc du genre :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
     
     
    offre frm = new offre();
    Panel p = new Panel();
    p.Width = 300;
    p.Height = 300;
    p.BorderStyle = BorderStyle.Fixed3D;
    p.Top = 10;
    p.Left = 10;
     
    frm.Controls.Add(p);
    frm.ShowDialog();

  3. #3
    Membre confirmé
    Inscrit en
    Septembre 2008
    Messages
    230
    Détails du profil
    Informations forums :
    Inscription : Septembre 2008
    Messages : 230
    Par défaut
    oui mais avec ca j'ai mon instance de ma form de base ce que j'aimerais c'est avec l'instance de l'onglet choisie

  4. #4
    Membre expérimenté
    Profil pro
    Inscrit en
    Août 2010
    Messages
    164
    Détails du profil
    Informations personnelles :
    Localisation : Belgique

    Informations forums :
    Inscription : Août 2010
    Messages : 164
    Par défaut
    l'onglet ??

    Peux tu montrer le code ?

  5. #5
    Membre confirmé
    Inscrit en
    Septembre 2008
    Messages
    230
    Détails du profil
    Informations forums :
    Inscription : Septembre 2008
    Messages : 230
    Par défaut
    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
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
     
     
      private void tabControl1_Click(object sender, EventArgs e)
            {
     
     
     
     
                int i3 = 0;
                i3 = tabControl1.TabPages.IndexOf(tabPage3);
     
                if (tabControl1.SelectedIndex == i3 && Menuclicker == false || Menuclicker == true)
                {
     
     
                    TabPage page = tabControl1.TabPages[i3];
     
                    TabPage tp1 = new System.Windows.Forms.TabPage();
     
                    tp1.Name = "page" + i3.ToString();
     
                    tp1.Text = "page" + i3.ToString();
     
                    tabControl1.TabPages.Add(tp1);
                    tabControl1.TabPages.Remove(page);
                    tabControl1.TabPages.Insert(i3 + 1, page);
                    System.Windows.Forms.Panel newpanel = new Panel();
                    newpanel.Size = new Size(1006, 616);//taille du panel
                    tp1.Controls.Add(newpanel);
     
                    Offre Form1Instance = new Offre();
     
                    //objs.Add(new Offre());
                    //foreach (Offre Form1Instance in objs)
                   // {
                        //Form1Instance.listView2 = new WindowsApplication1.SMK_EditListView(Form1Instance.labelttHT, Form1Instance.labelTVA, Form1Instance.labelPrixRemise, Form1Instance.labelTotalTTC, Form1Instance.grid4, Form1Instance.label5, Form1Instance.labelPrixRemise2, Form1Instance.labelHTtt, Form1Instance.labelHTtt2);
                        if (radioButton1.Checked == true)
                        {
                            Form1Instance.radioButton1.Checked = true;
                        }
                        if (radioButton2.Checked == true)
                        {
                            Form1Instance.radioButton2.Checked = true;
                        }
     
                        if (radioButton3.Checked == true)
                        {
                            Form1Instance.radioButton3.Checked = true;
                        }
     
                        if (radioButton4.Checked == true)
                        {
                            Form1Instance.radioButton4.Checked = true;
                        }
     
                        if (radioButton5.Checked == true)
                        {
                            Form1Instance.radioButton5.Checked = true;
                        }
     
                        //this.panel5.Controls.Add(Form1Instance.li
                        // this.panel5 = new System.Windows.Forms.Panel(Form1Instance);
                        //  Form1Instance.panel4.BackColor =  Color.FromArgb(193, 208, 48);
                        newpanel.Controls.Add(Form1Instance.panel4);
                        Form1Instance.Grid4(Form1Instance.grid4, Form1Instance.panel3);
     
     
                        Form1Instance.Offre_Load(Form1Instance, e);
                        // this.tabPage2.BackColor = Color.WhiteSmoke;
                        Form1Instance.richTextBox1.Text = this.richTextBox1.Text;
                        Form1Instance.grid4[1, 2].Value = this.grid4[1, 2].Value;
                        Form1Instance.grid4[2, 3].Value = this.grid4[2, 3].Value;
                        Form1Instance.grid4[3, 2].Value = this.grid4[3, 2].Value;
                        Form1Instance.grid4[3, 1].Value = this.grid4[3, 1].Value;
                        Form1Instance.grid4[4, 2].Value = this.grid4[4, 2].Value;
                        Form1Instance.grid4[6, 1].Value = this.grid4[6, 1].Value;
                        Form1Instance.grid4[8, 1].Value = this.grid4[8, 1].Value;
                      //  Form1Instance.grid4[8, 2].Value = this.grid4[8, 1].Value;
     
     
     
                        //CheckBox ligne 6
                        if (Convert.ToBoolean(Form1Instance.grid4[6, 1].Value.ToString()) == true)
                        {
                            //RowSelection = 6;
                            SourceGrid.Cells.Editors.TextBox stringEditorValidating = new SourceGrid.Cells.Editors.TextBox(typeof(string));
                            stringEditorValidating.Control.Validating += delegate(object sendere, CancelEventArgs cancelEvents)
                            {
                                string ancienvaleurcellule = Form1Instance.grid4[6, 2].Value.ToString();
                                try
                                {
                                    // ancienne valeur pour cent Escompte
                                    // ancienne valeur euros Escompte
                                    string val = ((TextBox)sendere).Text;
     
                                    val = Form1Instance.modificationpoint(val);
     
     
                                    if (val != "")
                                    {
     
     
     
                                        if (Form1Instance.grid4.Selection.ActivePosition.Row == 6 && Form1Instance.grid4.Selection.ActivePosition.Column == 2)
                                        {
                                            string ancienvaleur = Form1Instance.grid4[6, 2].Value.ToString();
     
                                            if (Form1Instance.grid4[4, 7].Value == "" || Form1Instance.grid4[4, 7].Value == null)
                                            {
                                                MessageBox.Show("Attention aucune valeur pour l'Acompte !!");
                                                ((TextBox)sendere).Text = ancienvaleur;
     
                                            }
                                            else
                                            {
                                                // MessageBox.Show("valeur" + " " + this.grid4[4, 16].Value.ToString());
                                                ((TextBox)sendere).Text = val + "%";
                                                Form1Instance.grid4[6, 2].Value = val + "%";
     
                                                double doubleacompte = double.Parse(Form1Instance.grid4[4, 7].Value.ToString().Replace("€", ""));
                                                double pourcentescompte = double.Parse(Form1Instance.grid4[6, 2].Value.ToString().Replace("%", ""));
                                                Form1Instance.presenceEscompte = true;
                                                Form1Instance.listView2.presenceEscompte = true;
                                                Form1Instance.AficherTableau(Form1Instance.listView2);
     
     
                                            }
                                        }
     
     
     
     
     
                                        if (Form1Instance.grid4.Selection.ActivePosition.Row == 6 && Form1Instance.grid4.Selection.ActivePosition.Column == 3)
                                        {
     
     
                                            string ancienvaleur = Form1Instance.grid4[6, 3].Value.ToString();
     
                                            if (Form1Instance.grid4[4, 7].Value == "" || Form1Instance.grid4[4, 7].Value == null || Form1Instance.grid4[4, 7].Value.ToString() == "0,00 €")
                                            {
                                                MessageBox.Show("Attention aucune valeur pour l'Acompte !!");
                                                ((TextBox)sendere).Text = ancienvaleur;
     
                                            }
                                            else
                                            {
                                                double doubleacomptevaleur = double.Parse(Form1Instance.grid4[4, 3].Value.ToString().Replace("€", ""));
                                                // string CodeCommenataire = this.li.SubItems[2].Text;
                                                bool b;
                                                b = val.Contains("€");
                                                double doubleval = 0;
                                                if (b == true)
                                                {
                                                    doubleval = double.Parse(val.Replace("€", ""));
                                                }
                                                else
                                                {
                                                    doubleval = Convert.ToDouble(val);
     
                                                }
                                                if (doubleval > doubleacomptevaleur)
                                                {
                                                    MessageBox.Show("la valeur ne peut pas être supérieur a l'Acompte !!");
                                                    ((TextBox)sendere).Text = ancienvaleur;
                                                }
                                                else
                                                {
                                                    // MessageBox.Show("valeur" + " " + this.grid4[4, 16].Value.ToString());
                                                    ((TextBox)sendere).Text = string.Format("{0:C}", doubleval);
                                                    this.grid4[6, 3].Value = string.Format("{0:C}", doubleval);
     
                                                    double valeurescompte = double.Parse(Form1Instance.grid4[6, 3].Value.ToString().Replace("€", ""));
                                                    double pourcentescompte = (doubleval / doubleacomptevaleur) * 100;
                                                    Form1Instance.grid4[6, 2].Value = pourcentescompte.ToString("0.00") + "%";
                                                    Form1Instance.presenceEscompte = true;
                                                    Form1Instance.listView2.presenceEscompte = true;
                                                    Form1Instance.AficherTableau(Form1Instance.listView2);
                                                }
     
     
                                            }
     
     
     
                                        }
     
                                    }
                                }
                                catch
                                {
     
                                    MessageBox.Show("Valeur Incorrect !!");
                                    ((TextBox)sendere).Text = ancienvaleurcellule;
     
                                }
     
     
     
                            };
     
                            this.testy2(6, Form1Instance.grid4);
                            if (this.grid4[6, 2].Value != null)
                            {
                                Form1Instance.grid4[6, 2].Value = this.grid4[6, 2].Value;
                                Form1Instance.presenceEscompte = true;
                            }
                            Form1Instance.grid4[6, 2].Editor = stringEditorValidating;
                            Form1Instance.grid4[6, 3].Editor = stringEditorValidating;
     
     
                        }
     
                        if (Convert.ToBoolean(Form1Instance.grid4[8, 1].Value.ToString()) == true)
                        {
     
                            SourceGrid.Cells.Editors.TextBox stringEditorValidating = new SourceGrid.Cells.Editors.TextBox(typeof(string));
                            stringEditorValidating.Control.Validating += delegate(object sendere, CancelEventArgs cancelEvents)
                            {
                                try
                                {
                                    string val = ((TextBox)sendere).Text;
                                    if (val != "")
                                    {
     
                                        if (Form1Instance.grid4.Selection.ActivePosition.Row == 8 && Form1Instance.grid4.Selection.ActivePosition.Column == 2)
                                        {
                                            string anciennevaleur = Form1Instance.grid4[8, 2].Value.ToString();
                                            ((TextBox)sendere).Text = val + "%";
                                            Form1Instance.grid4[8, 2].Value = val + "%";
     
                                            double doubleacompte = double.Parse(Form1Instance.grid4[4, 7].Value.ToString().Replace("€", ""));
                                            double pourcentescompte = double.Parse(Form1Instance.grid4[8, 2].Value.ToString().Replace("%", ""));
                                            Form1Instance.presenceEscompte = true;
                                            Form1Instance.listView2.presenceEscompte = true;
                                            Form1Instance.AficherTableau(Form1Instance.listView2);
     
     
                                        }
                                    }
     
                                }
                                catch
                                {
     
                                    MessageBox.Show("Erreur");
                                }
                            };
     
                        }
     
                        //this.tabPage2.Controls.Add(Form1Instance.panel4);
                        //this.listView2.Groups.Clear();
                        System.Windows.Forms.ListView.ListViewItemCollection collectionditems = new ListView.ListViewItemCollection(Form1Instance.listView2);
                        //this.listView2.Items.CopyTo(Form1Instance.listView1.Items);
     
                        for (int i = 0; i < this.listView2.Items.Count; i++)
                        {
     
                            lvi4 = Form1Instance.CreateListViewItem(this.listView2.Items[i].SubItems[0].Text, this.listView2.Items[i].SubItems[1].Text, this.listView2.Items[i].SubItems[2].Text, this.listView2.Items[i].SubItems[3].Text, this.listView2.Items[i].SubItems[4].Text, this.listView2.Items[i].SubItems[5].Text, this.listView2.Items[i].SubItems[6].Text, this.listView2.Items[i].SubItems[7].Text, this.listView2.Items[i].SubItems[8].Text, this.listView2.Items[i].SubItems[9].Text);
                            //string nom = ((string)lvi4[i]).getnom();
                            Form1Instance.listView2.Items.Add(lvi4);
                            Form1Instance.listView2.li = lvi4;
                            ListViewGroup groups = new ListViewGroup();
     
     
     
                            ListView.ListViewItemCollection items = this.listView2.Items;
                            //lvi4.Group = new ListViewGroup("Listview");
     
     
                            //Form1Instance.listView2.Items[i].Group = this.listView2.Items[i].Group;
     
                            //lvi4.Group = Form1Instance.lvi2.Group;
     
     
                        }
                       // Form1Instance.listView2.Groups.Clear();
     
     
                      /*  MessageBox.Show(Form1Instance.listView2.Items.Count.ToString());
     
                        Form1Instance.AficherTableau(Form1Instance.listView2);
                        foreach (ListViewGroup test in this.listView2.Groups)
                        {
                            Form1Instance.listView2.Groups.Insert(0,test);
                        }
                    */
     
                    /*
                            //this.listView2.Items.Clear();
                            ListViewGroup testgroup = new ListViewGroup(Form1Instance.listView2.li.SubItems[1].Text, HorizontalAlignment.Left);
                            int index3 = Form1Instance.listView2.Items.IndexOf(Form1Instance.listView2.li);
     
     
                            System.Collections.Hashtable hashListViewToGroupHeader = new System.Collections.Hashtable(20);
                            foreach (ListViewItem lvi in Form1Instance.listView2.Items)
                            {
                                hashListViewToGroupHeader[lvi] = lvi.Group.ToString();
                            }
     
                            Form1Instance.listView2.Groups.Clear();
     
     
                            foreach (ListViewItem lvi in Form1Instance.listView2.Groups)
                            {
                                int groupIndex = -1;
                                // First make sure that the group for the Item exists  
                                for (int i = 0; i < Form1Instance.listView2.Groups.Count; i++)
                                {
                                    if (Form1Instance.listView2.Groups[i].Header.CompareTo(hashListViewToGroupHeader[lvi]) == 0) // If we have a match,   
                                    {
                                        groupIndex = i; // Save the index of this group  
                                    }
                                }
                                if (groupIndex < 0) // If we were unable to find the group, create/add a new one  
                                {
                                    ListViewGroup lvg = new ListViewGroup((string)hashListViewToGroupHeader[lvi]);
                                    Form1Instance.listView2.Groups.Add(lvg);
                                    groupIndex = Form1Instance.listView2.Groups.IndexOf(lvg); // Get the index  
                                }
                                // Add the group to the listviewItem, group collection  
                                lvi.Group = Form1Instance.listView2.Groups[groupIndex];
                            }
     
     
                            foreach (ListViewGroup groupcuisine in Form1Instance.listView2.Groups)
     
                            // foreach (ListViewGroup groupcuisinee in toRemove)
                            {
                                for (int i90 = 0; i90 < Form1Instance.listView2.Items.Count; i90++)
                                {
                                    bool b = false;
                                    string groupcommentaire = lvi3.Group.Items[i90].Group.ToString();
                                    string chainefinale = "";
                                    string chaine = "";
                                    b = groupcommentaire.Contains("   ");
                                    if (b == true)
                                    {
                                        chaine = lvi3.Group.Items[i90].Group.ToString();
                                        string espaces = "   ";
                                        chainefinale = chaine.Substring(0, chaine.IndexOf(espaces));
     
     
                                    }
                                    else
                                    {
                                        chainefinale = groupcuisine.ToString();
     
                                    }
                                    if (lvi3.Group.Items[i90].Group == null)
                                    {
                                        int groupIndex = Form1Instance.listView2.Groups.IndexOf(groupcuisine);
     
                                        if (this.listView2.li.SubItems[1].Text.ToString() == chainefinale)
                                        {
                                            ListViewGroup tt = new ListViewGroup(groupcuisine.ToString(), HorizontalAlignment.Left);
                                            Form1Instance.listView2.li.Group = tt;
     
     
     
     
                                        }
     
     
     
                                    }
                                }
                            }
                    */
     
                        //Form1Instance.triergroup(Form1Instance.listView2, Form1Instance.lvi2);
     
     
     
     
     
                       foreach (ListViewGroup group in this.listView2.Groups)
                        {
                            Form1Instance.listView2.Groups.Insert(0, group);
                        }
     
                        for (int i10 = 0; i10 < Form1Instance.listView2.Items.Count; i10++)
                        {
                            foreach (ListViewGroup group in Form1Instance.listView2.Groups)
                            {
                                bool b = false;
                                string groupComentaire = group.ToString();
                                string chainefinale = "";
                                string chaine = "";
                                b = groupComentaire.Contains("   "); // 4 espaces 
                                if (b == true)
                                {
                                    chaine = group.ToString();
                                    string espaces = "   ";
                                    chainefinale = chaine.Substring(0, chaine.IndexOf(espaces));
     
                                }
                                else
                                {
                                    chainefinale = group.ToString();
     
                                }
                                if (Form1Instance.listView2.Items[i10].SubItems[1].Text == chainefinale)
                                {
     
                                    Form1Instance.listView2.Items[i10].Group = group;
                                }
                            }
                        }
                       // LVT_ListViewSort lv10 = new LVT_ListViewSort(Form1Instance.listView2);
                      //  lv10.ColSorter.WDColToSortByNum("+0");
     
     
                        Form1Instance.grid4[6, 1].FindController<SourceGrid.Cells.Controllers.CheckBox>().CheckedChanged += Form1Instance.testy(6, Form1Instance.grid4);
                        Form1Instance.AficherTableau(Form1Instance.listView2);
                    Form1Instance.ChiffreLigne();
                    Form1Instance.fraisdetransport(Form1Instance.listView2, Form1Instance.grid4);
                    Form1Instance.panel4.BackColor = Color.WhiteSmoke;
                        //this.triergroup(this.listView2);
     
     
                        /*
                        
     
     
                }
     
                if (tabControl1.SelectedIndex == 1)
                {
     
     
                    Offre Form1Instance = new Offre();
                    Offre Form1Instance2;
     
                    if (radioButton1.Checked == true)
                    {
                        Form1Instance.radioButton1.Checked = true;
                    }
                    if (radioButton2.Checked == true)
                    {
                        Form1Instance.radioButton2.Checked = true;
                    }
     
                    if (radioButton3.Checked == true)
                    {
                        Form1Instance.radioButton3.Checked = true;
                    }
     
                    if (radioButton4.Checked == true)
                    {
                        Form1Instance.radioButton4.Checked = true;
                    }
     
                    if (radioButton5.Checked == true)
                    {
                        Form1Instance.radioButton5.Checked = true;
                    }
     
                    //this.panel5.Controls.Add(Form1Instance.li
                    // this.panel5 = new System.Windows.Forms.Panel(Form1Instance);
                    Form1Instance.panel4.BackColor =  Color.FromArgb(193, 208, 48);
                    this.panel5.Controls.Add(Form1Instance.panel4);
                    Form1Instance.Grid4(Form1Instance.grid4, Form1Instance.panel3);
     
     
                    Form1Instance.Offre_Load(Form1Instance, e);
                    this.tabPage2.BackColor = Color.WhiteSmoke;
                    Form1Instance.grid4[1, 2].Value = this.grid4[1, 2].Value;
                    Form1Instance.grid4[2, 3].Value = this.grid4[2, 3].Value;
                    Form1Instance.grid4[3, 2].Value = this.grid4[3, 2].Value;
                    Form1Instance.grid4[3, 1].Value = this.grid4[3, 1].Value;
                    Form1Instance.grid4[4, 2].Value = this.grid4[4, 2].Value;
                    Form1Instance.grid4[6, 1].Value = this.grid4[6, 1].Value;
     
                    //CheckBox ligne 6
                    if (Convert.ToBoolean(Form1Instance.grid4[6, 1].Value.ToString()) == true)
                    {
                        //RowSelection = 6;
                        SourceGrid.Cells.Editors.TextBox stringEditorValidating = new SourceGrid.Cells.Editors.TextBox(typeof(string));
                        stringEditorValidating.Control.Validating += delegate(object sendere, CancelEventArgs cancelEvents)
                        {
                            string ancienvaleurcellule = Form1Instance.grid4[6, 2].Value.ToString();
                            try
                            {
                                // ancienne valeur pour cent Escompte
                                // ancienne valeur euros Escompte
                                string val = ((TextBox)sendere).Text;
     
                                val = Form1Instance.modificationpoint(val);
     
     
                                if (val != "")
                                {
     
     
     
                                    if (Form1Instance.grid4.Selection.ActivePosition.Row == 6 && Form1Instance.grid4.Selection.ActivePosition.Column == 2)
                                    {
                                        string ancienvaleur = Form1Instance.grid4[6, 2].Value.ToString();
     
                                        if (Form1Instance.grid4[4, 7].Value == "" || Form1Instance.grid4[4, 7].Value == null)
                                        {
                                            MessageBox.Show("Attention aucune valeur pour l'Acompte !!");
                                            ((TextBox)sendere).Text = ancienvaleur;
     
                                        }
                                        else
                                        {
                                            // MessageBox.Show("valeur" + " " + this.grid4[4, 16].Value.ToString());
                                            ((TextBox)sendere).Text = val + "%";
                                            Form1Instance.grid4[6, 2].Value = val + "%";
     
                                            double doubleacompte = double.Parse(Form1Instance.grid4[4, 7].Value.ToString().Replace("€", ""));
                                            double pourcentescompte = double.Parse(Form1Instance.grid4[6, 2].Value.ToString().Replace("%", ""));
                                            Form1Instance.presenceEscompte = true;
                                            Form1Instance.listView2.presenceEscompte = true;
                                            Form1Instance.AficherTableau(Form1Instance.listView2);
     
     
                                        }
                                    }
     
     
     
     
     
                                    if (Form1Instance.grid4.Selection.ActivePosition.Row == 6 && Form1Instance.grid4.Selection.ActivePosition.Column == 3)
                                    {
     
     
                                        string ancienvaleur = Form1Instance.grid4[6, 3].Value.ToString();
     
                                        if (Form1Instance.grid4[4, 7].Value == "" || Form1Instance.grid4[4, 7].Value == null || Form1Instance.grid4[4, 7].Value.ToString() == "0,00 €")
                                        {
                                            MessageBox.Show("Attention aucune valeur pour l'Acompte !!");
                                            ((TextBox)sendere).Text = ancienvaleur;
     
                                        }
                                        else
                                        {
                                            double doubleacomptevaleur = double.Parse(Form1Instance.grid4[4, 3].Value.ToString().Replace("€", ""));
                                            // string CodeCommenataire = this.li.SubItems[2].Text;
                                            bool b;
                                            b = val.Contains("€");
                                            double doubleval = 0;
                                            if (b == true)
                                            {
                                                doubleval = double.Parse(val.Replace("€", ""));
                                            }
                                            else
                                            {
                                                doubleval = Convert.ToDouble(val);
     
                                            }
                                            if (doubleval > doubleacomptevaleur)
                                            {
                                                MessageBox.Show("la valeur ne peut pas être supérieur a l'Acompte !!");
                                                ((TextBox)sendere).Text = ancienvaleur;
                                            }
                                            else
                                            {
                                                // MessageBox.Show("valeur" + " " + this.grid4[4, 16].Value.ToString());
                                                ((TextBox)sendere).Text = string.Format("{0:C}", doubleval);
                                                this.grid4[6, 3].Value = string.Format("{0:C}", doubleval);
     
                                                double valeurescompte = double.Parse(Form1Instance.grid4[6, 3].Value.ToString().Replace("€", ""));
                                                double pourcentescompte = (doubleval / doubleacomptevaleur) * 100;
                                                Form1Instance.grid4[6, 2].Value = pourcentescompte.ToString("0.00") + "%";
                                                Form1Instance.presenceEscompte = true;
                                                Form1Instance.listView2.presenceEscompte = true;
                                                Form1Instance.AficherTableau(Form1Instance.listView2);
                                            }
     
     
                                        }
     
     
     
                                    }
     
                                }
                            }
                            catch
                            {
     
                                MessageBox.Show("Valeur Incorrect !!");
                                ((TextBox)sendere).Text = ancienvaleurcellule;
     
                            }
     
     
     
                        };
     
                        this.testy2(6, Form1Instance.grid4);
                        if (this.grid4[6, 2].Value != null)
                        {
                            Form1Instance.grid4[6, 2].Value = this.grid4[6, 2].Value;
                            Form1Instance.presenceEscompte = true;
                        }
                        Form1Instance.grid4[6, 2].Editor = stringEditorValidating;
                        Form1Instance.grid4[6, 3].Editor = stringEditorValidating;
                        /*
                        SourceGrid.Cells.Views.Cell blanc = new SourceGrid.Cells.Views.Cell();
                        blanc.BackColor = Color.White;
     
                        DevAge.Drawing.BorderLine border3 = new DevAge.Drawing.BorderLine(Color.Black);
                        DevAge.Drawing.RectangleBorder cellBorder3 = new DevAge.Drawing.RectangleBorder(border3);
                        blanc.Border = cellBorder3;
                        blanc.TextAlignment = DevAge.Drawing.ContentAlignment.BottomRight;
     
                        SourceGrid.Cells.Views.Cell blanc2 = new SourceGrid.Cells.Views.Cell();
                        blanc2.BackColor = Color.White;
     
                        DevAge.Drawing.BorderLine border30 = new DevAge.Drawing.BorderLine(Color.Black);
                        DevAge.Drawing.RectangleBorder cellBorder30 = new DevAge.Drawing.RectangleBorder(border30);
                        blanc2.Border = cellBorder30;
                        blanc2.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter;
     
                        SourceGrid.Cells.Views.Cell blanc3 = new SourceGrid.Cells.Views.Cell();
                        blanc3.BackColor = Color.White;
     
                        DevAge.Drawing.BorderLine border300 = new DevAge.Drawing.BorderLine(Color.Black);
                        DevAge.Drawing.RectangleBorder cellBorder300 = new DevAge.Drawing.RectangleBorder(border300);
                        blanc3.Border = cellBorder300;
                        blanc3.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleLeft;
     
                        Form1Instance.grid4[6, 2].View = blanc2;
                        Form1Instance.grid4[6, 3].View = blanc;
                        Form1Instance.grid4[6, 6].View = blanc3;
                        Form1Instance.grid4[6, 7].View = blanc;*/
     
     
                    //}
                        Form1Instance.changercouleur();
                }
                Menuclicker = false;
            }
    j'aimerais recupere l'instance Form1Instance créer comment faire pour les différencier

Discussions similaires

  1. Réponses: 12
    Dernier message: 05/01/2015, 13h42
  2. Réponses: 2
    Dernier message: 23/11/2012, 15h25
  3. Créer une nouvelle page dynamiquement
    Par od.dev dans le forum Rave
    Réponses: 4
    Dernier message: 07/11/2011, 16h05
  4. Comment créer une nouvelle instance
    Par leberluxe dans le forum MySQL
    Réponses: 1
    Dernier message: 17/05/2011, 18h54
  5. Réponses: 2
    Dernier message: 03/02/2004, 21h56

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