Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8970615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T17:45:10+00:00 2026-06-15T17:45:10+00:00

I would like to make multiple subs with the same name but with different

  • 0

I would like to make multiple subs with the same name but with different parameters.

For example:

Public Sub DoThis(Byval CustomerName As String)   
Public Sub DoThis(Byval CustomerID As Integer)
Public Sub DoThis(Byval CustomerID As Integer, ReferenceID As Integer)

But then VB.NET is telling me that such a sub already exists.
Can somebody please tell me how I can do this?

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T17:45:11+00:00Added an answer on June 15, 2026 at 5:45 pm

    What you’ve shown us absolutely works – VB won’t complain about this.

    This is called Overloading and it’s an essential feature of .NET. However, in order for this to work you need to make sure that the signatures (i.e. the parameter type lists) are strictly distinct for all your overloads.

    Here’s an example to showcase the importance of distinct parameter type lists:

    Sub DoThis(CustomerName As String) …
    Sub DoThis(ProductName As String) …
    

    The subs look distinct. But how should VB handle the following call?

    DoThis("Meyer")
    

    It cannot know whether “Meyer” is a customer name or a product name (in fact, it could well be either!) – so VB forbids these declarations. However, the following is absolutely fine, because unambiguous:

    Sub DoThis(Customer As Customer)
    Sub DoThis(Product As Product)
    
    DoThis(New Customer("Meyer"))
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to make multiple arrays with different dimensions in Matlab. Is there
I would like to make a series of plots using ggplot from multiple different
I would like to make a single Android app for multiple Android versions (possibly
I would like to observe changes in multiple form fields and make a call
Would like to make anapplication in Java that will not automatically parse parameters used
I would like to make my app freeware, but if a user is willing
I have some code that runs fairly well, but I would like to make
I made an iPhone application, and now I would like to make multiple more
I need to make multiple NSURLConnections to a JSON Web Service. I would like
I would like to make a .sh that runs multiple other ones .sh in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.