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


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

Make Visual Basic Objects Arrays?

May 1, 2012

im trying to make picture boxes as arraybox(0)box(1)ecti want it to be an array so i can make infinite of them

View 15 Replies

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

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

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

Array Of Child Objects In Nested Classes And Accessing Child Objects In .Net

Jan 3, 2012

I have a nested class, let's call it class1 and it has class2 inside it; VB.Net eg:[code]

1) How can I define X number of Class2 objects[let's call it: Node(x) array]** with NEW() subroutine called?' this raises error: dim cls2(n) as new class2 end sub.

2) How can I return actual number of Node() array? [code]Outside my class in main project I define cls1 object:[code]Now an array of class2 is created inside cls1.

3) Now,How can I access All of them[node(x) array which is created inside cls1] with all properties and methods available?

I remember I wrote a ProcessManager class with this functionality in .net 2003, nearly 4 years age, I don't have the code now.

View 1 Replies

Classes And Arrays How To Initialize

Nov 1, 2011

working on some partial classes but I ct figure out how to do it.This is my classes:

Partial Public Class Form
Private InfoField() As Info
Private FormgroupField() As FormGroup

[code].....

View 1 Replies

Declaring Arrays For Web Service Classes?

Jul 29, 2009

I need to initialize an array variable that belongs to a class supported by a Web Service. Theoretically it should have looked like that: Dim k(100) As New Appoint2.BookingData()However, it throws up an error message saying that 'Arrays cannot be declared with New'.I have managed to find a walk around: Dim k As Appoint2.Unit() = New Appoint2.Unit() {}But it creates only a zero-length array and I have no idea how to define its length. Wherever I try to put its length parameter (100) an error message emerges.

View 3 Replies

Classes And Objects?

Aug 29, 2010

The 1st part of the code required me to write a class definition for a class(Worker). The class should include Private variables and Property procedures for a worker object's name and salary.

The salary may contain a decimal place. The class should also contain two constructors:a default and a parameterized.

The second part for the code indicates that I need add a method named GetNewSalary to the Worker class.The method should calculate a Worker objects new salary, which is based on a raise percentage provided by the application using the object.

Before calculating the new salary, the method should verify that the raise percentage is greater than or equal to zero. If the raise percentage is less than zero the method should assign the number zero as the new salary

There are three text boxes which allows the user to enter the employees name current salary and raise percentage....the calculate button will display the new salary in the new salary label box...so far here is what I have for the worker class.

The Class for the code had to be written from scratch. Can you please look over the class code and see if I need to chang anything....that will allow the program to run.[code...]

View 1 Replies

Accessing Objects From Other Classes In ASP.NET

Sep 7, 2010

In ASP.NET I have a form that has a Textbox named txtOutput and a button. In the main file.aspx.vb I can call a function from the button handler and in that function I can have [code]I have a bunch of functions in several other classes. For instance I have a class named AbleCommerce that does some database functions. These functions are called from my main class. In those functions, however, I have no visibility of txtOutput.All of my classes are, unfortunately, in the default namespace which I understand is not optimal but didn't seem to impact this issue.

View 2 Replies

Collection Of Objects Of Different Classes?

Dec 28, 2011

suppose I have a collection of objects of different classes (like controls in a form), and all of their classes have a MyMethod extension method. How do I have the appropriatemethod be called for each object, depending on its type?or example,

For Each ctrl In Me.Controls
'call ctrl real type's MyMethod
Next

[code]....

View 6 Replies

Creating Classes And Objects?

Apr 10, 2011

1) Add a Private variable named _area2) Associate the _area variable with a Property procedure called Area3) Change the CalculateArea method to a Sub procedure. The method should calculate the area and then assign the result to the _area variable.4) Include a parameterized constructor in the class. The constructor should accept one argument: the side measurement. After using the Public property to initialize the Private variable, the constructor should automatically call the CalculateArea method.At this point I believe I've completed the first 2 steps for the Square method, but I'm not sure where to go from therHere is my code for the Square class and the Main Form, in tha order:

Public Class Square
Private _side As Integer
Private _area As Integer

[code].....

View 3 Replies

Programmed For A While And Mainly Used Classes As Objects?

Mar 5, 2010

Pursuing the Microsoft Certified Professional Developer Certification and working through the training kit.I've programmed for a while and mainly used classes as my objects.The training certification book I'm working through has a section on structures. they look very similiar to classes so my question is: why use them? Do they offer something that creating a class doesn't? What's the difference between structures and classes?

View 8 Replies

Trying To Understand Classes And Objects ?

Jun 5, 2010

I've been trying to understand classes and objects. Yes, I'm thick headed and slow, but I made the decision to go to .Net and I am determined to improve my coding skills to be more efficient. I have spoken to Atma several times on the topic and read most of his posts concerning classes and objects, but still came away a little baffled (He's really advanced for me yet). I needed a simplistic analogy for a reference point to begin understanding. I was reading about OOP written by MikeJ in the following thread/post ...[URL] and it all started to become clear in this statement , but I would like some reassurance that I'm getting it ..."A car IS-A vehicle, while a dog HAS-A tail. The car would be an object declared as type Vehicle, while the dog would have a member that IS-A tail. However, Fido IS-A dog. The dog class is the base template for all dog objects, so when we declare Fido as a dog, Fido is an object. Since Fido IS-A dog, Fido HAS-A tail."

From this I have taken the following understanding...

Vehicle ... ' Class
Car ....... ' Object
Truck ... ' Object
Van ....... ' Object

And from that can I infer that this is true?

Dog ....... ' Class
Fido ... ' Object
Tail .. ' Member of Fido

So to apply this to a program I wrote recently that tracks Generator service...

Generator ' Would be the class
Brand X ' Would be an object
Spark Plug ' Would be a member
Gas Tank ' Would be a member
Brand Y ' Would be an object
Brand Z ' Would be an object

This statement also helped ...

""Class" and "object" are sometimes used interchangeably. However, classes describe the structure of objects, while objects are instances of classes. Each instance is an exact copy of its base class. Because an object is an "instance" of a class, the act of creating an object is called instantiation. To describe it better, a class is a blueprint, and an object is a building based on that blueprint". I can understand this (I think) and it refers to a basic template such as ..."Generator" (my class or blueprint or template) Generators have an engine, powerplant, fuel tank, etc. These are basic requirements to be a generator. (Template or Blueprint) They can differ by Brand of engine, Size of powerplant, and type of fuel used. (Based on template or blueprint) Do I have it down now? MikeJ also made this statement ..."you can't access certain types of class members from outside of the class itself." From this I assume you would need to assign a Global variable the value of the class member if you needed to use it outside of the class?

View 17 Replies

What's The Relation Between Classes And Objects

Oct 14, 2009

relation between Classes and Objects with an example.Md. Marufuzzaman

View 7 Replies

One Dimensional Arrays (accumulate The Value Of Each Item Of The Array) And Classes

Dec 12, 2010

I have written a class for my one dimensional array The idea is to collect user information, put the info into an array and accumulate the value of each item of the array so there is a running total. The problem is that the code is not totalling the array when my btnSum is clicked or maybe at all. I am getting no errors, but I am also getting no total.

[Code]...

View 9 Replies

Base Classes On Proxy Objects

Sep 25, 2011

I have a webservice that is wrapped up by a data access object and is accessed by many different UI controls.

The proxy objects look something like this:

Public Class WebProxyObject1
' Common properties, there are about 10 of these
Public Name As String

[Code]....

View 1 Replies

Creating A Class That Contains Other Classes/Objects?

Aug 27, 2010

I'm wondering on how you would go abouts instantiating a class that contains other complex objects. for example an Payment Class which has Date,Time, etc.. and it also holds a reference to a paymethod object which has id,Type,Description etc.. How do you instantiate the payment class with all the other objects without one or the other failing, how do you create the payment class which doesn

View 4 Replies

Multiple Classes For Serialize Objects?

May 9, 2009

I have one class with <Serialize> attribute called Tree. And Tree class has an arraylist of TreeNode classes. Is it possible to use Soap to convert the Tree class and arraylist of TreeNode classes to one xml file or binary file? If it is possible, do i need to use <Serialize> attribute on TreeNode classes too? If not, what should i do then?

View 3 Replies

Reference Objects On Webpages In The Classes

Feb 26, 2010

I have a project where a email is sent when the user clicks send on the web page, however the content of the email will change depending on what is inputted by the user. I have added classes to my project so that depending what is selected by the user different classes are selected and as such different emails then sent from the project.

[Code]...

View 9 Replies

Syntax For Arrays Of Objects?

Jun 22, 2009

What is the VB.NET syntax for declaring the size of an array of objects at runtime?To get an idea of what I mean, here is the code so far:

Private PipeServerThread As Thread()
Public Sub StartPipeServer(NumberOfThreads As Integer)' ??? equivalent of C#
' ??? PipeServerThread = new Thread[numberOfThreads];

[code].....

View 2 Replies

Creating Classes For Master Child Objects

Dec 26, 2010

I have a Clients master object and then a number of child objects whose exact number is not known in advance such as Client-Contacts, Client-Payments etc, all of which have a one-to-many relationship with the Client master object.How do I define classes for such a scenario? Do I for instance create the master Clients class and can then I create an array of class somehow for child objects?

View 2 Replies

Easy Way To 'rewrite' To Take Advantage Of Classes And Objects?

Jul 2, 2009

I have a VB.NET web app that is about 2000 lines of code, contains about 20 different subroutines, and about 50 different functions.Is there an easy way to "rewrite" this to take advantage of classes and objects?

View 5 Replies

2 Dimensional Arrays Of Control Objects

Jul 11, 2009

I have the read the article "Creating Control Arrays in Visual Basic .NET" (link: [URL]) and I its very good and useful code for 1D array of objects. What if someone wants to make a 2D array of control objects. For example creating a "table" of 8x8 buttons that will be able to change properties by using the arrays x-y coordinates. Something like button(x,y). backcolor.black or similar.

View 3 Replies

Make Objects From The ToolBox Using Code Instead Of Changing Existing Objects Invisible Then Visible Later?

Dec 5, 2011

make objects from the ToolBox using code instead of changing existing objects invisible then visible later?

View 7 Replies







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