-2

I am pretty new to this. Basically, I created a c# class library with a subclass that has a method that needs to be called in the main app (WPF) - When trying to call method from said subclass, I get the error code

CS7036 There is no argument given that corresponds to the required formal parameter 'identifiant' of 'Personnels.CreerListePersonnel(string, string, string, string, string)

...and can't seem to figure out why.

Here is my subclass :

public class Personnels { //Liste qui sera reponsable de gérer le personnel List<Personnel> personnels = new List<Personnel>(); public void CreerListePersonnel(string identifiant, string prenom, string nom, string nomUtilisateur, string motPasse) { personnels.Add(new Personnel(identifiant, prenom, nom, nomUtilisateur, motPasse)); } } 

Here is where I am calling it in my main app:

public partial class frmLoggin : Window { Personnels personnels = new Personnels(); bool ouverture = false; public frmLoggin() { InitializeComponent(); try { personnels.CreerListePersonnel(); ouverture = true; txtUtilisateur.Focus(); } catch (Exception ex) { MessageBox.Show(ex.Message + Environment.NewLine + "L'application prendra fin.", "Attention", MessageBoxButton.OK, MessageBoxImage.Information); Application.Current.Shutdown(); } } 

.....

Again, I am new to this and I'm not sure if I am doing things properly :(

Thanks in advance !

0

1 Answer 1

0

You need to provide the required information (parameters) to the method.
The method signature looks like this:

public void CreerListePersonnel(string identifiant, string prenom, string nom, string nomUtilisateur, string motPasse) 

So your call would have to look something like this:

try { personnels.CreerListePersonnel("xyz123", "Bobby", "Smith", "Bob", "password1"); ouverture = true; txtUtilisateur.Focus(); } 
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for this. I realized how this question can seem really stupid but I was stuck and didn't have access to a teacher at the time. I really appreciate the help! I just didn't have the right logic. Everything worked out good :)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.