How Many Objects Inside Of A Class Is Too Many

Jul 1, 2011

I'm fairly new to the concepts of OO programming - actually programming in general as I am still a student. I'm currently working as an intern in a department that has me coding a new structure that will probably be the base for all their applications to come. So I believe I have the idea behind OO down where you create "basic building blocks" and then expand, expand and expand, until you arrive at the most complex object (for the time being). I need to put all these "advanced" objects into one but how many is too many? Can I have 100 objects inside of this bigger object if it requires all these "parts".I really hope this question makes sense to everyone. I'm sure the answer is not going to be a definite answer either but I just need a rule of thumb to go by. I'd really hate to have 100 objects inside of 1 big one if there is a better design/programming technique. [code]

View 2 Replies


ADVERTISEMENT

Modifying Objects Inside For Each Loop Sets Properties Of All Objects With Values Of Last One?

Jan 29, 2011

I have a program like this.

Module Module1

Public Class Mstr
Public Property Prop1 As String
Public Property Prop2 As String[code]....

But it is not working as I expect it to. You can see it from.The DtlsB properties of all three DtlsA objects are having values from last iteration.

View 1 Replies

Call Method Base Class In Program Passing Sub Class Objects?

Apr 22, 2012

Base class has one field to hold numeric balance value. With 2 methods that accept arguments for adding and subtracting the new input calculating new balance. Sub class has four fields dates, transaction, memo and amount.I have a deposit form, and withdraw form. Each time one transaction is entered it creates an object with sub class fields, then adds to the account collection. My problem is not understanding how to call the deposit/withdraw method and pass the current transaction amount back to the base class to alculate the new balance. Does anyone have any links to information/tutorials on how to perform something like this? As you can see with my code I have tried various different approaches without any success.

[Code]...

View 5 Replies

Class That Inherits Another Class In Which There Are Objects That Are Disposed In Dispose Procedure

Feb 14, 2010

If I have a class that inherits another class in which there are objects that are disposed in the dispose() procedure, do I use mybase.dispose? ex Class A inherits Class B. [code]

View 2 Replies

Inside The Service Class, Declare A Class Variable Named Started?

May 8, 2012

Create a class named Service. Inside the Service class, declare a class variable named Started. The datatype of this variable is Boolean.Public Class Service Dim started as Boolean End Class Create a class named Server. Inside the Server class, declare a dynamic array that can contain elements of the type Service.(Note: For convenience, both the array and the variable Started can be accessible from a client program that creates an instance of Server and Service respectively)

Create a constructor for the Service class. When the constructor is executed, it will set the value of the class variable Started to True. Create two new classes: WebServer and DatabaseEngine. Both of these classes inherit from the class Service. Inside the Service class, declare a Sub procedure (method) named Terminate. This method should display the following text Service stopping in a message box when executed.This method can be overridden in classes that inherit from Service class.

Inside both the WebServer and DatabaseEngine class, override the method Terminate inherited from their base class Service. Both methods should first call the base class Terminate method. The messages Web server stopping and Database engine stopping should also be displayed in a message box when the Terminate method for the WebServer and DatabaseEngine are called respectively. These messages should only be displayed if the Started variable inherited from their base class is not equal to False.

Inside the Server class, declare a method named Shutdown. This method does not return any value. When executed, it will call the Terminate method for each of the Service instances (if any) in the arrServices
array. You should call the Terminate method within a For Each loop that loops through the elements of the arrServices array.

In the Sub Main method, create an instance of the class Server. Set the size of the arrServices array in
your Server instance to contain 2 elements. Create first a WebServer instance and then a DatabaseEngine
instance into this array. Call the Shutdown method from your Server instance.

View 7 Replies

Get A Value Inside Parent Class From Child Class (in Nested Classes)?

Jan 1, 2012

I have Class1 and class2 which is inside class1, VB.NET code:

Public Class class1
Public varisbleX As Integer = 1
Public Class class2

[code]....

View 1 Replies

How To Assign A Different Reference To A Class Instance From Inside The Class Code

Jan 18, 2011

my proble is the following: I have a class MyClass and another class Modifier, which has a method ModifyMyClass(ByRef mc as MyClass) that receives a MyClass instance as ByRef parameter to modify it. A smell of the code is:

[Code]...

View 4 Replies

VS 2008 Reference Parent Class From Inside Child Class?

Apr 11, 2009

I have a 'property management class' that contains several functions and properties. I have several other classes that use the 'management class' as a property to derive the value of several of its other properties.Is there a way for me to reference the outer class from the 'management class' functions without having to pass it as a parameter? I ask because several different classes can have this 'management class' as a property and am having a hard time typing the parameter.

View 7 Replies

Print A Panel And Its Objects Inside?

Dec 26, 2010

i have created a panel wherein i am to insert the labels and data needed for printing. i have found a code to print labels and textboxes, however, datagridview is not included in the code.

Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PrintDocument1.Print()
End Sub

[code]....

View 5 Replies

Access The Base Class Inside A Derived Class?

Oct 22, 2010

How do I access the base class inside a derived class?

View 1 Replies

Handle An Event Raised In Class Inside Own Class?

Apr 14, 2009

I have a "partial" class in VB.NET. Half of it is auto generated by a code generation tool. That half implements INotifyPropertyChanged, so any properties in that part of the partial class raise the PropertyChanged event.In my "custom" part of the class, I declare another property that depends on one of the properties in the auto-generated side. Therefore, when that auto-generated property changes, I also want to raise a PropertyChanged event on my custom property that depends on it.

If I go into the generated part of the class and raise the event there, that will get overwritten if I ever re-generate that part, so I don't want to do that. I would rather add an event handler in my side of the partial class that checks if the generated property changed, and if so, raise another event for my custom property.

[Code]...

I'm assuming it's because normally you'd use the WithEvents keyword to tell the compiler that you're subscribing to events from that object. I don't have a clue how to do this inside of the class that's actually raising the event, or if that's even possible.

View 1 Replies

IDE :: Class Files. Same As Namespace Or The Same As The Class Object Inside?

May 22, 2009

If my namespace is Company.Application.EDI.Acknowledgement and if I stick with theprogramming practice of one class per file then should my class be saved asacknowledgement.vb? Are there any gotchas that will come up?

View 5 Replies

Base Class Collection With Sub Class Objects

Jul 19, 2010

[code]The reason that this is a problem is that this is a collection of EventBase objects, but I'm trying to populate it with child classes instead. For example, I might have a JumpEvent class that inherits EventBase, and this is being put into the EventBaseCollection. That means that value.GetType() returns the type of JumpEvent, which as you might guess does not equal the type of EventBase.The goal of course is to simply loop through all of the various events without having to know anything about the sub-classes. Is there a way to determine the type of the base class so that the OnValidate call will work? Or is this just the wrong way to go about it altogether?

View 2 Replies

Create Objects Of C# Class From Program Class In DNN?

Feb 23, 2011

Can we create objects of a C# class from a VB.NET class and vice versa?

View 2 Replies

Call '.dispose' On Objects Inside Functions?

Jul 22, 2010

say you have a sub containing an io.streamwriter. That streamwriter is declared and used only inside that sub (and not as static). Should you still call dispose on that streamwriter or is it disposed automatically as it is no longer in use after that sub, until you call that sub again?

View 2 Replies

Traverse / Iterate Through All The Objects Inside A Form?

Feb 18, 2010

I have a VB class inside which one of the methods accepts an array of forms. For each form inside the array, I need it to traverse all of the objects, check if they are a specific tyoe (input, label, checkbox, etc.) and get the properties of each object. Then, I want to dump these into a text file in the following format:

[Code]...

View 4 Replies

Make Class Array Inside Class

Feb 28, 2012

I am New to <acronym title="Visual Basic">Vb</acronym>.Net. this is my first test. i try to create small address book. but i don't know what wrong. it compile perfect but when it run it give error and not work. is there any other way to add same class like in class inside array?

[Code]...

View 6 Replies

VS 2010 Arrayed Class Inside A Class?

Nov 27, 2011

Haven't coded in a while, and ran into a wall when setting up my program data structure

So I have something like this in a class file;

Public Class X
Public Stuff as Integer
Public Stuff1 as String

[Code].....

I want to structure my program this way, what's the best way to go about that?

I want to access multiple data types in the same array from within a class, as it should be a subset of my base class etc... and want to be able to change the size of the array

Or is this class array within class nesting a dead end?

View 5 Replies

Asp.net - Structure A Class Inside A Class?

Jun 3, 2011

Currently, if I have different classes containing functions etc, I would structure them all in the 1 VB file titled whatever the main Class is. For example:

[Code]...

However, the problem with this is the file can become 1000s of lines long making hard to find portions of code. Is there a way I can store SubClass in a file such as MainClass.SubClass.vb so that its easier to locate classes? Or is there a better, more standard, way of doing this?

View 3 Replies

A Property In A Class Is A Collection Of Objects

Jan 29, 2009

Thought I had got this sorted earlier but unfortunately not. A property in a class is a collection of objects.

[Code]...

View 4 Replies

Array Of Self-Referencing Objects In A Class

Aug 23, 2010

How can I implement a tree structure (Octree) in Visual Basic.

that is to declare a class containing array of objects of same class type - like

Class Node
{
dim ....

[Code].....

View 3 Replies

Class - Using Variables For Referencing Objects?

Feb 25, 2010

when using variables in object names.I have a Public class which is called "Tank".In that class, there is a public property called "direction" of an integer type.I keep getting the error:

"Tank is a type and cannot be used as an expression"What I'm doing wrong here ?

Public Class mainroutines()
Create Instances of tank
Private Tank1 As New Tank()[code]....

View 3 Replies

Create An Array Of Objects From A .net Class?

Oct 6, 2010

I need to create an array of a class type. Populate the values in the class and then pass the array to a subroutine. I havent figured out how to do this properly as I get a null reference exception. Can someone show me how to create/instantiate the array of objects? Here is a simple example with only one property named "_momentum". My actuall class has about 10 properties/variables in actuality

[Code]...

View 3 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

LINQ To XML Syntax And Class Objects In .net?

Dec 10, 2010

I have the following XML file

<Test>
<Modules>
<Module Name= "Test1">
<QueueName Name="Test1Active1" Active="True"></QueueName>
<QueueName Name="Test1Active2" Active="True"></QueueName>

[Code]...

View 1 Replies

Make An Array Of Class Objects In VB?

Sep 7, 2010

How can I make an array of objects in VB.net. Here is the requirement. Basically I have a class named hotel. I need to dynamically add customers to the hotel class using the Customer class. So basically if in the Hotel class I can have an array of Customer objects that would be great. How can I do this in VB .net ?

Public Class Hotel
' I need an array of Customer objects. objCustomers
End Class

[Code]......

View 2 Replies

Passing An Arraylist Of Objects From One Class To Another?

Aug 19, 2011

I have the following code in Class B

FolderList.add(FolderCategory)

when i do a count it display a list of 25 items in the folderlist.Now i have a main class when i tried to use the following method

Dim MainClass as New ClassB

Console.writeline(MainClass.FolderList.count()) the value reflects as 0 items meaning is empty.i need to retrieve the arraylist from Class B using the MainClass to retrieve those items inside the arraylist.

View 7 Replies

Put Between The Objects To Input A Class Statement?

Feb 21, 2012

In Visual Basic what do you have to put between the objects to input a class statement?

Class class1
object1
object2

[Code]....

View 5 Replies

Sort Of A Collection Of Class Objects?

Feb 28, 2012

I'm having problems doing a sort of a custom collection. The collection is Device Classes which is a collection of Device Class. My sort does not produce an error but the treeview control shows nothing. I am not sure what I am missing. I'm guessing just a simple sort won't work here but I don't know what I'm missing in my code. Here's the code that creates the collection

[Code]...

Simply sorting the treeview will not work because it throws off the display of related info for a given device in listview controls. The collection itself needs to be sorted before the data is added to the treeview.

View 6 Replies

.net - LINQ Union Objects With Same Base Class?

Apr 5, 2011

I'm trying to create a list of all my objects from several lists of objects using Union.

Return Chart.AnnotativeNodes.Union( _
Chart.DecisionNodes.Union( _
Chart.EndNodes.Union( _
Chart.StartNodes.Union(Chart.WorkCenterNodes))))

The above line gets an error because I can't union List(of AnnotativeNode) with List(of DecisionNode). Each list defined like List(of EndNode) or List(of StartNode), but each class inherits from the base type Node.Is there a possible way to union these to get a result of IEnumerable(of Node)?

View 1 Replies







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