views:

262

answers:

4

I'm trying to call a function, and VS gives me an error (red underline), and i have the option to "generate method stub". What is this?

A: 

It means that you're trying to call the function incorrectly; check to make sure you've spelled the method name correctly, and that you're passing it the proper number and types of arguments.

Adam Maras
+1  A: 

It means you typed a wrong signature, so VS assumes this method doesn't exist. By using the shortcut VS can help you create the method as a stub (i.e. the signature, then you have to fill out the implementation).

Brian Rasmussen
+1  A: 

The generate method stub will generate you a method which looks exactly like you've written it, with the same parameters. Probably are getting this error because you've misspelled the method or because it is in a different namespace.

Stefanvds
A: 

ahh I had

method(button.Tag);

and a declaration of

void method(int tag)

so i fixed it with

method(int.Parse(button.Tag.toString()));

i tried that before, but I forgot to put "toString", since I thought it was already an int... stupid little mistake. thx guys

jello
Are you sure that `method((int)button.Tag);` wouldn't work?
Gabe
that works too. but not method(int.Parse(button.Tag));
jello