C
C#14mo 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
LeviCodingOP14mo ago
How can I share my code again?
Denis
Denis14mo ago
$code
MODiX
MODiX14mo 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
Denis14mo ago
$codegif
Denis
Denis14mo ago
$details
MODiX
MODiX14mo 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
Denis14mo ago
What error are you receiving?
LeviCoding
LeviCodingOP14mo ago
BlazeBin - duvxayoocxyn
A tool for sharing your source code with the world!
LeviCoding
LeviCodingOP14mo ago
No description
LeviCoding
LeviCodingOP14mo ago
tried using static but than he doesn't accept the properties
Denis
Denis14mo 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
LeviCodingOP14mo ago
No description
LeviCoding
LeviCodingOP14mo ago
So I need to make NettoVerhuurPeriode static
Denis
Denis14mo 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
LeviCodingOP14mo ago
Ok no problem 😄
Denis
Denis14mo ago
var myInstance = new MyClass(); myInstance.NonStaticMethod();
LeviCoding
LeviCodingOP14mo ago
I think I fixed it I wrote Periode.Aantaluur() it had to be AantalUur()
Accord
Accord14mo 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