You have to add code to that constructor so that it knows what to do with the value of that parameter.īecause of the way the designer code works, it's possible to mess up your own constructor if you're not careful. If you want to be able to pass an argument to a constructor then you have to write a constructor with a parameter to pass an argument to. That means that the only way that you can create an instance of that type is by invoking the constructor and passing no arguments. ![]() ![]() When you add a form to your project, it will have a parameterless constructor by default, i.e. What exactly are you expecting to happen to that report inside the form and how are you expecting that to happen when you haven't written any code to do it? You're passing a report as an argument to that constructor but there's no code in it that knows what to do with it. ![]() The code of the method can't magically change when you call it so it requires that you pass an argument to each parameter and it also requires that you don't pass arguments for any parameters that don't exist. In the method body, those parameters will be used. ![]() When a method is written, part of the signature of that method is the number and type of parameters. a New method, and passing one argument but there is no constructor that has one parameter. Properly formatted code is easy to read and, importantly, easy to copy and paste in order to test if required.ĪS for your issue, the problem is exactly as the error message says.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |