Click here to Skip to main content
15,905,325 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
There is no argument given that corresponds to the required formal parameter 'Notes' of 'Form1.CreateNote(Note)

This is the problem I are experiencing!
I must fill parameter how !
Sorry ! I don't know describe how problem is !

What I have tried:

This is code
C#
<pre> if (reuslt == DialogResult.Yes)
            {
                try
                {
                    if (txt_note != null)
                    {
                        txt_mahs.Enabled = false;
                        CreateNote(); // <== Error 
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
        private void CreateNote(Note Notes )
        { // tạo ghi chú -----------
            var check = _en.Notes.Where(p => p.MaTL == (txt_mahs.Text)).FirstOrDefault();
            if(check != null )
            {
                DialogResult result;
                result = MessageBox.Show("Mã này đã được ghi chú ! Bạn có muốn sửa bản ghi chú ?","Warning !!!", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
                if (result == DialogResult.No)
                {
                    return;
                }
Posted
Updated 6-Jan-21 19:48pm
Comments
Richard MacCutchan 7-Jan-21 5:07am    
But surely you wrote the code?
Huyyhaha 12-Jan-21 3:21am    
yes! i wrote it.
Richard MacCutchan 12-Jan-21 4:31am    
Then you know how to fix it.

1 solution

Look at the error message:
There is no argument given that corresponds to the required formal parameter 'Notes' of 'Form1.CreateNote(Note)
Then look at the code that generates the error:
CreateNote(); // <== Error 

What it is saying is pretty clear: the Form1 method called "CreateNote" is defined as requiring a parameter called "Note".
You are trying to call it without passing it anything to Create.

Start by looking at the method definition, and work out what exactly you are supposed to pass it. Then come back to the line that generates the error and add the parameter data!

We can't do that for you - we have no idea what type Note should be, and no way to see the method definition to find out!

And since this is called CreateNote, then is a good chance it should return something like a new Note class instance - so you probably want to use its return value when you call it as well.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900