Using Modules Rather Than Classes?

Apr 15, 2010

What advantage is there, if any, to using Modules rather than classes in VB? How do they differ, and what advantages/disadvantages are there in using modules? In VB or VB.NET, I use both.

View 3 Replies


ADVERTISEMENT

IDE :: Windows Forms Classes Appear As Class Modules Not Form Modules In Project Explorer

Jan 7, 2011

Yesterday I opened Visual Studio (2008 v 9.0.30729.1) and all the winform classes in my project display with class module icons with the little 'VB', instead of form module icons with the little form icon!

When I double click on a form module, the form designer doesn't open, just the code module.

When I run the project, it runs fine. There are no errors. The project builds fine.

I did Project --> show all files, and I can see the designer and resx files below the form module which doesn't look or act like a form module.

I can't open my forms to design them!

View 1 Replies

Put Functions In Modules Or Classes

Mar 16, 2011

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?

View 5 Replies

Combining Classes And Modules Into One File?

Feb 5, 2011

Is it ok to use some classes and modules inside a single VB file ?

At present, I used to create them in separate files by choosing Project menu --> Add Class/Module

I was thinking about combing them into one file. Is there any merit or demerit on this approach ?

View 6 Replies

Make Classes/Modules/arrays And Objects?

May 18, 2010

This probably sounds daft, but im struggling to get to grips with Classes/Modules/arrays and objects, as well as there uses and what they are, and yes im still coding some how i hear you cry.The reason i ask is because Ive got a load of Dim's in my program that are the same giving locations of files and folders and wondered can they be used as a module that i can alter after the program is built, incase of folder locations being wrong or moved, manually correct after install.

View 1 Replies

Use Modules Instead Of Classes With Shared Member Functions?

May 19, 2009

Is it considered an acceptable practice to use Modules instead of Classes with Shared member functions in VB.Net?I tend to avoid Modules, because they feel like left over remains from VB6 and don't really seem to fit in anymore. On the other hand, there doesn't seem to be much difference between using a Module and a Class with only Shared members.

View 4 Replies

Moving Modules/classes/forms To A Common Folder?

Nov 23, 2009

I have two projects

a.sln and b.sln they have their own classes, modules and forms.

As I work on solution 'A' I devise a class and save it in solution A's folder. As the class develops, I now find a need for it in solution B.

How can I move it from solution A's folder to my Common folder then link it into solution A and B.

Currently I am doing this manually, Moving then linking to it. Is there a way to do this withing the IDE

View 14 Replies

VS 2005 Modules Vs Private Classes With Shared Members

Mar 28, 2011

I've read that modules are basically shared classes. For a module though, you can call a method directly without prefixing the module name. So I can do this: methodTest("abc", mod1Enum.enum2)But for a class with shared members I have to fully qualify the method call, and in this case fully qualify the enum:[code]In our conversion from VB6 to .NET the need to fully qualify all calls like this might be an argument for us to bring our VB6 modules over as modules instead of converting them to classes.

View 7 Replies

Visual Studio - Manage Multiple Files That Are Part Of One Class - Classes, Modules?

Sep 23, 2009

My VB project is large enough that it requires several files. It was originally developed as a Console App and I created each file as a MODULE. All modules could use subroutines, data structures and constants from other MODULES and everything worked fine. I needed to add basic windowing to the app and this required that the app be converted from a Console App to a Windows Forms App. The main window is Form1 which is not a MODULE but a CLASS. The problem is that some MODULE based functions cannot access subroutines, data and constants that are defined within the CLASS Form1 unless they are incorporated into the CLASS file and this makes the CLASS file very large. If I add a new Class file to the project, it also cannot interoperate with Class Form1 in the same way that multi-MODULE code interoperates.

How does one spread CLASS code across several files and still allow it to interoperate as if it were in a single file? Alternatively, how does one create several CLASS files that operate the way multiple MODULE files operate.I am sure that there are all kinds of best practices that I am violating but the goal to to get some prototype software working and interfaced to some lab equipment.

View 2 Replies

Use LINQ To Filter Collection Of Nested Classes To Yield Dictionary Of Unique Properties Of Those Classes?

Jan 23, 2012

I have two classes, one nested in the other. [code]Neither "Name" or "ID" are unique between operations and records.I wish to construct a dictionary using LINQ = Dictionary(Of String, Of List(Of Integer), whereby the keys are uniqe examples of Names in my collection and the values are the collective set of distinct IDs that are associated with those names.

View 2 Replies

VS 2010 Structure Classes So That The User Interfaces Though A Single Class While The Supporting Classes Are Hidden From Their View?

Jun 13, 2012

How can I structure my classes so that the user interfaces though a single class while the supporting classes are hidden from their view? I think its best understood in an example:

Public Class MyInterface
Public Economic as EconomicClass
Public Sub New()
MyBase.New()

[code].....

So you might ask why am I even separating them? It's strictly for others who will be working with this interface. I need to funnel them though a logical structure:

interface.Economic.MyMethod
interface.Currency.MyMethod
etc

This way everything is already handled for them in the background and they only need to run the method they need. I don't know if I can have it both ways in VB.NET.

View 23 Replies

VS 2010 Calling Subs And Functions Within Classes That Are Within Classes?

Oct 24, 2009

Here is some example code of what I mean:

vb
Public Class Form1
Private Sub Button1_Click(ByVal sender as Object, e as systemEventArgs) Handles Button1.Click

[Code]....

View 5 Replies

Derived Classes Cannot Raise Base Classes

Jul 10, 2009

I m trying to raise Click event of Textbox explictly but I m getting "Derived classes cannot raise base classes" error.[code]....

View 1 Replies

Are Modules The Same As VB6 Bas Files

Aug 22, 2010

using bas files in visual basic 6 because I could write functions or subs that I would just easily use over and over rather than keep rewriting code. Do these work in the same way in .net? If anyone has any good info on modules like how to start writing functions and subs. Assuming of course that they work like vb6 bas files. If I were to make this sub a function how would I do this and I am assuming the benefit of this specific example would be a Boolean to check if if saved the text file or not?

Code:
Public Sub SaveList(ByVal List As ListBox, ByVal filename As String)
Dim i As Integer
Dim w As IO.StreamWriter

[code]....

View 1 Replies

Using Modules In .NET Considered?

Jun 7, 2011

During the design of a new application I was wondering if using a module with properties is considered to be a bad practice. Some example code:

Module modSettings
public property Setting1 as string
public property DatabaseObject as IDatabaseObject
End Module

The code above is just an example to emphasize my question. In the past, this structure was used a lot in VB6. In the past I used it as well in my .NET projects.

But nowadays with buzzwords like Dependency Injection, Testability and Separation of Concerns the above structure smells bad. I can't really describe why, but it just feels wrong. I must admit I'm not very familiar with the keywords above, yet.So I'm wondering whether the above code really is a bad practice. If so, what would you use a Module for?

View 4 Replies

VS 2010 - Modules - Add Something Behind Sub

Oct 9, 2009

I created a module named Sample, in it i made a Public Sub called Sub. But how do i do to add something "behind sub", so i can write like this:

Sample.Sub.alternative1
Sample.Sub.alternative2
etc.

View 5 Replies

Hide Both Of The Modules Upon Execution?

Feb 22, 2012

I have finished creating the code for my client/server application although both parts currently execute modules/in console(this was for testing purposes).I am now looking at making both parts of the program completely invisible (they will eventually be executed as a Windows service upon startup). How do i go about this? Does the code need to be copied in to a "Windows Service" project, or is there a way I can hide both of the modules upon execution?

View 5 Replies

.net - Using The Same Modules In Multiple Projects?

Dec 30, 2010

I'm using Visual Studio 2010 and coding in VB.NET.

My problem is that I've collected all the modules I've written and intend to reuse and placed them in a separate folder. When I want to add a module from the above folder to any given project, it takes a copy of the module and places in the project's source code folder, instead of referencing the module in the folder containing all the other modules.

Is it possible to include a module in my project and leave it in the folder with all the other modules, so that when I improve upon a module, it'll affect all the projects that uses/references that module. Instead of me having to manually copy the new module to all the projects that uses/references the module. Right now I have multiple instances of the exact same module that i need to update manually when I improve code or add functionality?

View 3 Replies

.net - Visual Basic And Modules?

Jun 24, 2012

Im writing a application in visual basic to tell the user about their pc.

All this is in a module

Imports Microsoft.VisualBasic.Devices
Imports System.Management
Imports System.Net
Imports System.IO

[Code]...

The problem I am having is that if one of the things in the module fails such as if the users graphics card does not have any onboard memory then it will fail.This is causing everything else to fail aswell.I am very new to visual basic so ifyou could please excuse me if I have made any stupidly obvious errors and any suggestions are welcome

View 1 Replies

Are Modules Used To Organize Code

Apr 11, 2011

I have been brought onto a project where a large amount of code has been written. Most of the code is appearing in the MainWindow.xaml.vb file (yes, this is a wpf project but I think the question is appropriate for this forum). The folks who developed the previous versions in Visual Basic 6 told me that they organized their code by using Modules. I was not aware of this practice and I have actually never even used modules. Can I use modules in this way so that I can logically group different areas of functionality within the application? Or is there a more preferred method?

View 2 Replies

How To Create Class And Modules

May 15, 2009

I am fresher in vb.net but I need some samples on structure which contains fields,method,property and events and if some one help me regarding private,freind, protected freind type class etc. In addition to that I know how to create class and modules but i don't know where I create structure and how etc.

View 1 Replies

IDE :: Modules Window While Debugging

Oct 7, 2009

I have read many many forums regarding the error message "No symbols have been loaded. The breakpoint will not be hit." I had this error message come up a while ago, so I opened a previous version of my project, and copied the newest version of the code I am working on into that project. Then when I debugged, everything worked fine...for a while. Then I got the error message back, so I did the same thing again, and who would have guessed the error message returned, out of the blue. I am working on the program and it works fine, then suddenly one time when I try to debug with a breakpoint I get that message again. So I did some more research and I found a post that recommended looking at the Modules window while debugging (under debug > windows > modules). And in this window under my project, it said "Cannot find or open the PDB file". However, I compared this to the previous version of the program, that works fine, and I noticed that under Path, for my project, the path that I see is not the path where my project is located. So what I am asking is can someone please tell me how to change that path to the correct path where my files are actually located? I believe that if the path is correct, it will find and load the symbols.

View 1 Replies

Merge Modules With Crystal 10?

Mar 23, 2005

I have learned that if I want my crystal reports to work on the client machines when they install my program, I have to include some merge modules. I have VB .Net 2003 and Crystal Reports 10. The merge modules that are included with VS Studio .Net 2003 are not included in the program software I have. Is it possible to download these merge modules somewhere else and use them with my software? If so, can someone give me a link on where to get them?

View 16 Replies

Number Of Memory (RAM) Modules?

Jun 26, 2009

I'm finishing up a remote inventory service. Getting the total memory is simple. But, is there any way to detect how many memory modules a computer has and how many MB/GB each is?

View 2 Replies

Same Name Methods In Different Modules Cause Ambiguity

May 20, 2010

I have 2 modules. Each contains a Sub with the same name. See below:
Module moduleA
Public Sub f(ByVal arg1 As myType)
Console.WriteLine("module A")
End Sub
End Module

Module moduleB
Public Sub f(ByVal arg1 As myType, ByVal arg2 As Boolean)
Console.WriteLine("module B")
End Sub
End Module

But the compiler complains that there's ambiguity between moduleA and moduleB. I have totally different signatures. However, if I put the 2 methods into the same module, there's no ambiguity at all.

View 1 Replies

Split Big Project Into Modules

Aug 18, 2009

I have a big project in vb.net with over a 400 forms and datasets and 100 reports. I deploy it using clickatonce. I want to split it into modules so each user will use the core project plus the modules his department needs, so when I make an update to a module he will take only this update and not the whole project as I am doing now.

View 3 Replies

VS 2008 How Many Modules Can Have In One Program

Sep 8, 2009

I am doing a VB.NET course, there is a question in one of my assignments - "How many modules can you have in one program?" This seems like something that should be easy to find, but I have not been able to find it anywhere.Can anyone direct me to a resource that would have this? My initial thought is unlimited, although in practical terms, if you have an excess number of modules, then you probably need to re-think your workflows.

View 3 Replies

VS 2008 Publics Modules?

Jan 26, 2010

i have a public module un an application1 , how can i get the module in application2 ?

View 2 Replies

Are Modules Still Commonly Used In Program Structures

Aug 18, 2010

I am not a program designer by any means but I would really like to start getting a better grasp of how to do it and a better understanding of the .NET languages in general (VB, C#). I was reading a book by Wrox - Professional Visual Basic 2008. In it I believed it mentioned that Modules are slowly going out of existence. I can see why most coding would go into a class object but I would assume modules would always be necessary to at least keep the code clean.

Also, I have been searching for a good source on software design but I can't seem to find any recent books published. I might be searching in the wrong places but I would really like to get my hands on one.

View 4 Replies

Forms :: Threading And Modules And Sleep

Mar 31, 2011

I have a frm_Main, which starts a thread. The thread then goes and calls a module, which has a thread.sleep() in it. This causes the mouse to freeze up while it sleeps, despite being called by the child thread. I thought this would have be on the thread time-slice? However it is causing my form to freeze for the sleep duration.

[Code]...

View 8 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved