Questions tagged [method-call]

386 questions
4
votes
2 answers

Can you call a function in MainWindow.Xaml.cs from App.Xaml.cs?

This seems doable but for some reason the proper way is not occurring to me. I am new to C# and .NET so I hope this isn't a ridiculous question :)
nicky
  • 268
  • 2
  • 5
  • 13
4
votes
3 answers

C++ virtual (sealed) function

I am using classes from a dll in my C++ project. All is working fine, until... When trying to call a certain method (listed in the object browser), I am getting an error that this method is not a member of the namespace. Upon investigation, I…
user228058
  • 465
  • 1
  • 7
  • 22
4
votes
4 answers

Java: Calling a static method in the main() method

I am supposed to do the following: Write a Java application (Client) program with a static method called generateEmployees( ) that returns a random list of 10 different types of Employee objects. You could either use an array or an ArrayList to…
4
votes
2 answers

Java called method return value as a switch case value

I have to use a value, typically return via a method in switch case. int getVal(){return 121;} switch(expr){ case getVal(): } But its giving comilation error: constant expression required. I also tried like, int _val = getVal(); …
Amit Yadav
  • 32,664
  • 6
  • 42
  • 57
3
votes
1 answer

Isn't java suppose to match overloaded functions to most specific type?

I have a set of derived classes (mathematical values, such as Length, Angle, Value) and I'm defining calculation functions for them. The overloaded functions aren't being called as I expected. Problem boiled down to simple form... public abstract…
3
votes
2 answers

How do I call anotherfile.bat :label correctly in Batch?

I have a Batch file that's a library of functions like :findmsbuild if exist msbuildpath.txt ( for /f %%i in (msbuildpath.txt) do set MSBUILD="%%i\MSBuild.exe" ) else ( set VSWHERE="%ProgramFiles(x86)%\Microsoft Visual…
Ansis Māliņš
  • 1,684
  • 15
  • 35
3
votes
1 answer

Java method will not execute multiple times

I'm trying to get the method printMethod to execute 6 times for 6 different inputs, but it takes one input, outputs the result once and then ends. I have tried positioning the method calls in different locations but it doesn't seem to make any…
Charlie
  • 230
  • 1
  • 9
3
votes
5 answers

Order of Precedence with methods?

Say I have 2 methods. One is an method triggered by the selected index changing in the listbox. The second method helps by clearing all textboxes, setting listbox index to -1, and setting the focus. Question: Method two executes, during the code it…
sheldonhull
  • 1,807
  • 2
  • 26
  • 44
3
votes
3 answers

Difference between Calling a Sub and Application.Run

In my business, we have a few teams that work on very simple macros. I'm trying to make them all readable to each other and in somewhat of a similar format, so new joiners can start working on the data. I mention simple macros, because no one will…
Badja
  • 857
  • 1
  • 8
  • 33
3
votes
1 answer

How can I use Redux Saga "call" function when the function name is a reserved word and how do I do chained function calls?

yield action.user.delete() && database.ref(url).remove() I need to use call() in both functions in redux-sagas using Firebase functions. In action.user.delete(), I can't do yield {delete} = action.user or call([action.user, delete]), because…
Jose Alves
  • 142
  • 1
  • 10
3
votes
2 answers

Call method without self parameter in Perl

I would like to know if it is possible to call a method from an object without passing the self argument. As an example, I have a package: package MyPackage; sub new { my $class = shift; return bless {}, $class; } sub test { …
3
votes
2 answers

Different Ways to Call Methods from Another Class

I am a beginner with the java language and programming as a whole. I understand that to call methods from another class, we call that method with: ClassName.methodName(arguments); For example, when we want to find the square root of an integer…
Zampanò
  • 574
  • 3
  • 11
  • 33
3
votes
3 answers

Android, Access Fragment method from separate class

I have a Fragment: public class CustomFrag extends Fragment{ ... public void refreshList(){ ... } } I have a separate Class: public class SomeClass{ ... } I am trying to call refreshList() from SomeClass: String tagName =…
Birrel
  • 4,754
  • 6
  • 38
  • 74
3
votes
1 answer

I keep getting the error "no match for call '(std::vector) (int)"

Before reading this problem please note that this is a PRACTICE problem for hp codewars (a programming competition), I am not asking the forum about a real problem. My program is supposed to take the following input: A number that represent the…
user4544749
3
votes
1 answer

Method not returning to user (inheritance)

I am trying to read in values to a HashMap from a Driver program to a separate abstract program. After that, I want the contents to be printed to the user. However, when I call the method nothing happens GameDriver import java.io.*; import…
Junikin
  • 301
  • 2
  • 14
1 2
3
25 26