C
C#ā€¢8mo ago
LeviCoding

ā” Using method in other class

In my program I have a method aantaluur() it is in the class Periode. I have some error but dont know how to fix it. The main class can't be changed because the task was to make the classes for this main.
21 Replies
LeviCoding
LeviCodingā€¢8mo ago
How can I share my code again?
Denis
Denisā€¢8mo ago
$code
MODiX
MODiXā€¢8mo ago
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat For longer snippets, use: https://paste.mod.gg/
Denis
Denisā€¢8mo ago
$codegif
Denis
Denisā€¢8mo ago
$details
MODiX
MODiXā€¢8mo ago
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, and what you expect the result to be. Upload code here https://paste.mod.gg/ (see $code for more information on how to paste your code)
Denis
Denisā€¢8mo ago
What error are you receiving?
LeviCoding
LeviCodingā€¢8mo ago
BlazeBin - duvxayoocxyn
A tool for sharing your source code with the world!
LeviCoding
LeviCodingā€¢8mo ago
No description
LeviCoding
LeviCodingā€¢8mo ago
tried using static but than he doesn't accept the properties
Denis
Denisā€¢8mo ago
You need to create an instance of that class to use its method. Otherwise, you can mark the method as static That'd allow you to use it without creating an instance
LeviCoding
LeviCodingā€¢8mo ago
No description
LeviCoding
LeviCodingā€¢8mo ago
So I need to make NettoVerhuurPeriode static
Denis
Denisā€¢8mo ago
You are missing the new keyword to create a new instance of of your class I'm unable to open the blazebin at this moment
LeviCoding
LeviCodingā€¢8mo ago
Ok no problem šŸ˜„
Denis
Denisā€¢8mo ago
var myInstance = new MyClass(); myInstance.NonStaticMethod();
LeviCoding
LeviCodingā€¢8mo ago
I think I fixed it I wrote Periode.Aantaluur() it had to be AantalUur()
Accord
Accordā€¢8mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server
More Posts