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

  • Home
  • SEARCH
  • 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 4063370
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T15:43:01+00:00 2026-05-20T15:43:01+00:00

I have a Module in VB.NET called Math.vb and in that module, I created

  • 0

I have a Module in VB.NET called Math.vb and in that module, I created a Function that displays returns the percentage of one number to another. I have a Sub that calls the Function and I call the Sub from my Form1 class. Is there an advantage/disadvantage to putting the function in the class or the module?

  • 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-05-20T15:43:02+00:00Added an answer on May 20, 2026 at 3:43 pm

    It all depends. Modules in VB.net are basically the same as static classes, but you don’t have to preface method names in a module with the “module name”.

    This makes modules a nice place to put “Utility” functions that are of a very generic nature and that don’t relate to any existing class. Your “Percentage” function would probably fit in this category.

    On the other hand, if you were to create a class that represented those numbers you’re calculating the percentage for, and one method of that class was going to be this “percentage” function, that would return the percentage based on the numbers that are defined within the class instance, then, yes, I’d put the function in a class.

    And finally, if the Percentage function would only make sense to be called from the Form1 class, then I’d make it a PRIVATE function in that class.

    For methods, you generally want to apply the most restrictive scope possible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

If I have a function that is called in few places in my module,
In Vb.net, we have something called a Module that provides a global scope whereby
I have a Class called MyMailSender that binds to the asp.net controller called EmailController.
I have an ASP.NET http module that adds a Response Filter and does some
I have an ASP.NET MVC form for adding a module to a site. The
I have a situation where I have several VB.NET Modules in the same Logical-Module
I have module application. When I run it, the main window of that app
I have module that implements custom content type via NodeAPI hooks ( hook_insert ,
I have a module modA , which contains a synthesized submodule modB (created with
I have this module pattern that stores a bunch of vars. I want to

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.