Bonsoir ,
j'ai un soucis dans une appli winforms voici l'erreur et les classes concernées
. Merci de toute Aide
Code : Sélectionner tout - Visualiser dans une fenêtre à part Erreur 1 'Contact_DAO.Contact' ne contient pas une définition pour 'Ajouter' et la meilleure surcharge de la méthode d'extension 'Contact_DAO.EntityObjectExtension.Ajouter(System.Data.Objects.DataClasses.EntityObject)' contient des arguments non valides C:\Users\doumbix\Documents\Visual Studio 2010\Projects\Contact_DAO\Contact_IHM\Gestion_Contact.cs 61 21 Contact_IHM
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.Linq; using System.Text; using System.Data.Objects.DataClasses; namespace Contact_DAO { public static class EntityObjectExtension { public static void Ajouter(this EntityObject aObject) { ContexteDAO.ContexteDonnees.AddObject(aObject.GetType().Name, aObject); ContexteDAO.Enregistrer(); } public static void Supprimer(this EntityObject aObject) { ContexteDAO.ContexteDonnees.DeleteObject(aObject); ContexteDAO.Enregistrer(); } public static void Rafraichir(this EntityObject aObject) { ContexteDAO.ContexteDonnees.Refresh(System.Data.Objects.RefreshMode.StoreWins, aObject); } } }
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 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using Contact_DAO; namespace Contact_IHM { public partial class Gestion_Contact : Form { private Contact ContactCourant { get { return (Contact)bdsGesContact.Current; } } public Gestion_Contact() { InitializeComponent(); } private void Gestion_Contact_Load(object sender, EventArgs e) { try { bdsGesContact.DataSource = Contact.AvoirLaListeContact(); } catch (Exception ex) { MessageBox.Show(ex.Message); } } private void CmdFermer_Click(object sender, EventArgs e) { this.Close(); } private void MenuContact_Opening(object sender, CancelEventArgs e) { e.Cancel = this.ContactCourant == null; } private void ajouterToolStripMenuItem_Click(object sender, EventArgs e) { Contact UnContact; DetailContact FormDetail; DialogResult result; try { UnContact =new Contact(); FormDetail = new DetailContact(UnContact); result = FormDetail.ShowDialog(); if (result==DialogResult.OK){ UnContact.Ajouter(); //le soucis se trouve la !! bdsGesContact.Add(UnContact); } } catch(Exception ex){ MessageBox.Show(ex.Message); } } private void modifierToolStripMenuItem_Click(object sender, EventArgs e) { } } }
Partager