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

Did you find this page helpful?