Fog Creek Software
Discussion Board

Welcome! and rules

Joel on Software 2003: Method has multiple definitions

I'm pretty new to this VB stuff, so I'd appreciate any help!!
Anyway, when I go to run my project, I receive an error," 'Method IsStringInRange' has multiple definitions with identical signatures."  I am using this method in a function to validate user input (lastName e.g.), and it works fine.  When I use this same method to validate a second user input (firstName, e.g.), I get the error message.  While the error message is true (that is, I am using the IsStringInRange method for multiple validations), that's what I want... the same method to validate the other fields.  I have changed the controls to whom the method is supposed to be validating (txtLastName.text vs txtFirstName.text e.g.).  Anybody help me??

Sunday, February 29, 2004

Well, lets start off with what a method definition is. When you have 'Public Function IsStringInRange(ByVal lastName As String) As Boolean' that is the method definition, with whatever is between the parenthesis being the signature.

So, if within you class, you have two methods:

Public Function IsStringInRange(ByVal lastName As String)
Public Function IsStringInRange(ByVal firstName As String)

you are going to see the identical signature error, because from the compiler's standpoint, it won't know which method to call, as all it cares about is the type of variable being passed in, not the name.

If I am way off, it may help to post the snippet of your code you are having problems with.

Sunday, February 29, 2004

Use different names (i.e., "IsStringValidFirstName" vs. "IsStringValidLastName").

Brad Wilson (
Sunday, February 29, 2004

*  Recent Topics

*  Fog Creek Home