Include An Array In Class Properties?

May 21, 2010

I am trying to build a class that includes an array so that I can refer to each element in the array. For example, let's presume I'm building a class that includes student id, student name, and then an array of 8 courses (numbered 0-7). I'd like to be able to refer to:

baseClassName.Course(0)
baseClassName.Course(1)

etc...but I know that's NOT how it's done...but how IS it done?

View 7 Replies


ADVERTISEMENT

Include Array Of Class In A Class?

Aug 6, 2011

I want to include Arrary of Class in a class. For Example

Public Class AddressSet
Private addressValue As String
Private effectiveDateValue As Date

[code]....

my goal is let the user add address maximum 10 addresses under one name How do I implement "Property" to have array AddressSet using array index?.

View 9 Replies

Custom Class As An Array Of Properties?

Sep 30, 2009

I'm moving my first steps in the VB.NET world (I come from VB6) and I'm stuck with the creation of a particular class.

Let's say we have a bus that always has 101 places. I'm trying to create a class containing the map of the bus, along with methods to graphically represent it.

My "Bus" class will have a couple of properties ("BusColor", "BusModel") related to the whole bus. Then it should have a property called "Places" whose type is a custom class thet represents every single place, along with, for example, the passenger name or the place number. This property should of course be an array.

This is my code so far (simplified):

Public Class BusMap
Private Const MAX_PLACES As Integer = 101
Private _BusModel As String = ""

[Code]....

but I wonder if there is a more standard way of doing this.

My second question is: how can I modify my class to be able to iterate its Places property with the "for each" statement? A quick search on the web showed up that I should implement the IEnumerable interface, but I'm still not enough confident with the concept of Interfaces.

View 6 Replies

Use Of .Include To Select From An Association Table Which Is Replaced By Navigation Properties

Jul 14, 2011

In my database I have 3 tables Act, ActVisi and Visi. Table ActVisi is an association table between Act and Visi tables. In My EF4 data model the association table ActVisi is replaced by a many to many navigation property in both Acts and Visis entities.I want to select the entries whose Visicode=1 (in the ActVisi association table). I have tried the query below and it works when I remove Include("Visis").Where(Function e.Code = 1) but I am getting all the results. How can I make the below query work. I suspect that my lambda syntax in vb is incorrect.

[Code]...

View 1 Replies

Can't Inherit Shared Properties From A Base Class In A Child Class?

Dec 29, 2010

This is another one of my "I think it's not possible but I need confirmation" questions.I have a base class for a bunch of child classes. Right now, this base class has a few common properties the children use, like Name. The base is an abstract class (MustInherit)Technically, this means that everytime a child class is instantiated, it lugs around, in memory, its own copy of Name. The thing is, Name is going to be a fixed value for all instances of a given child. I.e., Child1.Name will return "child_object1", and Child2.Name will return "child_object2".

View 1 Replies

Class With Class Properties: AObject Reference Not Set To An Instance?

Aug 19, 2009

I have a class in which some of the fields are also classes.I can put values in the "normal" properties, but in the others when o try to assign values it gives the: "Object reference not set to an instance of an object"But the code compiles fine.

dados_Defenicao = New ServiceReference1.draftClaimEntryDefinition
dados_Defenicao.arCode = "123"
dados_Defenicao.claimMarket.warrantyType = "w" - Here it gives the error

How can i fix this ?

View 6 Replies

Class With Class Properties: Object Reference Not Set To An Instance

Aug 19, 2009

I have a class in which some of the fields are also classes.

I can put values in the "normal" properties, but in the others when o try to assign values it gives the: "Object reference not set to an instance of an object"

But the code compiles fine.

dados_Defenicao = New ServiceReference1.draftClaimEntryDefinition
dados_Defenicao.arCode = "123"
dados_Defenicao.claimMarket.warrantyType = "w" - Here it gives the error

View 4 Replies

Include A Custom Utility Class With Our T4 Templates Generators?

Dec 2, 2011

How to include a custom utility class with our T4 templates generators ? I tried adding a module to the project but it seem there is no way to include it for my generators to use the methods from it.

View 2 Replies

Inheret A Base Class Control And Include That In An Asp Page?

Sep 7, 2011

I didn't realise there was a specific vb.net for asp section in the forum. I'm not having much luck getting the problem solved in that other subforum.

View 1 Replies

Calling Class (When Include Excel Automation) From Button Object

Apr 7, 2011

I am messing around with some Excel Automation just to get my feet wet and want to call some specific cells in my spreadsheet just for testing. I have one form in the project including a button. My question is how do I tell the button where to navigate to the cell to be tested?

My code for my Excel class is as follows:
Public Class Waybill
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oExcel As Object = CreateObject("Excel.Application")
Dim oBook As Object = oExcel.Workbooks.Open("C:\TesterXL.xls")
[Code] .....

View 6 Replies

C# - .NET: Getting A Class To Copy Properties Of One Class To Another?

Nov 10, 2010

I wrote a function that copies the properties of one class to another so make a copy of an object.So something like

MyObject myObject = myOtherObject.MyCustomCopy(myObject)
where myObject and myOtherObject are of the same type. I do it by bascually doing
myObject.prop1 = myOtherObject.prop1

[code]....

I am pretty sure in the past I used a .NET object that automaticaly did this, by reflection I guess, but can't remember it ... or an I imagining that such a method exists?

View 5 Replies

Class Properties Won't Set?

Jan 22, 2010

as you might guess from the variable names I'm making a game (but this problem isn't game related!) which involves multiple "bullets" moving along straight trajectories. This is my attempt at changing my code for firing one bullet into one for firing many bullets at once. It works perfectly except for one thing.The class I made (BulletClass) to contain all the things needed to move the bullet isn't setting all of its properties correctly. I apologise for the walls of code however I wasn't entirely sure whether I should chop bits out. I wanted to colour code my code so that you could scroll through and see the subs where things have gone wrong, but apparently I can't even code a new thread. Let alone a video game. Instead I'll just list them, you can search for them if you like or just scroll through at your leisure.

[Code]...

In a nutshell: the properties TargetPosY, TargetPosX, ShipPosX and ShipPoseY are not working properly. As a result the calculations involving them are skewed and the bullets always travel directly downward.

View 2 Replies

VS 2008 Adding Class Object To List Or Array In A Different Class

Jun 21, 2010

I am trying to create an list or an array of a class.Here is my "Ingredient" class that I am trying to create a list of:[code]In my "recipe" class, I am want to create a list (or array) and I am drawing a big blank on how to do it. Can anyone point me in the right direction?

View 2 Replies

Class Properties To DataTable?

Feb 7, 2009

I've got a Dictionary collection of a certain class with dozens of string properties.i'd like to create a datatable from this info and map these properties into Datatable columns, and for each member of the dictionary maps it to a row...

i could type out column names based on the class properties, but thats a bit specific and hard coded.

What I want to do is something like

Dim mytable as datatable For each string_property as property of myclass Dim column as new datacolumn(string_property.name) 'column add to table etc Next I'm unfamiliar with how to do this, maybe the Reflection classes are useful - perhaps the guru's can point out an efficient solution?

View 2 Replies

Clear All Properties In A Class?

Jun 9, 2010

Is there a way to clear all the properties in a class, because i have a class where all my properties were stored, can i clear all those in just a short code?

View 6 Replies

Dll - Public Properties From Another Class

Mar 8, 2012

I've tried searching... a lot for the answer, but as I'm not too sure what exactly I'm trying to do I can't seem to find anything. I'm trying to write a dll in order to handle errors thrown from a vb.net app. In the dll I need several forms (I'm not totally sure if they can have forms - I'm a bit of a newbie when it comes to dll's) for which the user can type in their message about the error and submit it.

[Code]...

View 1 Replies

Get Numbers Of Properties In Class?

Apr 17, 2010

I have dynamic class with varied numbers of property. At one time I need to save all data from this class. So, to do the For/Next or Do/Loop, I need to know, how many properties in class for now? Is it possible to findout the property numbers and after - property names list?

For example. I have a class INI, were was .Path as preexisted property. Then the few properties has been added and INI start consist of .Path, .Size, .Color and something else.

I dont want to keep in mind all properties has been added. All I want to get some simple loop to read all properties names and values to dump it to the file. Some sort of this[code]...

View 3 Replies

How To Change Properties Of Class

Feb 28, 2009

I am filling a form with values from a class, which is working fine. But now I want to take the changed values in the text box and modify the class. For some reason I have not been able to get the syntax.

View 6 Replies

How To Count Properties In A Class

Nov 20, 2010

I have created a class named CustomerType - CustomerTyp, which includes 4 properties - ID, Name, Number, Selected. I need to make a code, which determines how many properties has the class.

View 2 Replies

How To Get All Class Properties By Type

Mar 19, 2012

How can I get all the properties of a class that implement a specific base class or interface? I have a properties class that contains several other property classes. Some, not all, of these classes implement an interface. I would like to know if it's possible to iterate over all properties of parent class for child-classes that implement the target interface. It sounds like a job for reflection? I'm just not sure how. Can it be done via the "PropertyInfo" object?

View 1 Replies

How To Share Class Properties

Apr 17, 2010

I have an app with my own class "something".So, Im going to one of the my modules and declare public var as a class. After fillup this class by date, I would to get this date from the other module of my app. But there this var is unavailavle (its mean I have to redeclare it again. Its mean I'll lost

View 7 Replies

Iteract Through A Class Properties?

Aug 19, 2009

Whats the best way to iteract through a class to get all the properties names? So far i have this code

Dim classInstance As New ServiceReference1.draftClaimEntryDefinition
For Each PropertyItem As PropertyInfo In classInstance.GetType().GetProperties()
Dim strPropName As String = String.Empty[code]....

My problem is: I will receive a xml file, and have to get the data in a class, but as mentioned before the class has a lot of classes as properties, and i want do do it without hardcode, I want to loop the class properties names and compare them to the xml tags (it haves the same name as the class properties), and put the values from the xml file in an instance object of the class.

View 3 Replies

Looping Through Properties In A Class?

May 22, 2011

I have this class

Code:
Public Class Customer
Public Property AccountNumber() As String
Public Property AccountCreationDate() As String

[code].....

This works but I tried to loop thru the properties of the class with a For Each/Next loop. It does not work as the intellisense won't co-operate with Items I think i need like "PropertyInfo" . After reading, I see that only thru Reflection can I do this. Well, Reflection has me baffled at the moment.

View 5 Replies

Object From Class Of Properties In Vb?

Nov 20, 2010

I have a property grid and I want to be able to set the selectedobject to a class. The class contains properties. This is what I have, but it 'OtherFiles' is not an object.

pgProperties.SelectedObject(OtherFiles)

How do you create a class as an object. In VB.NET 2008 please. C# is ok.

View 1 Replies

Overload Two Properties Within The Same Class ?

Oct 15, 2009

I want to have use several versions of the same property within a userControl that inherits a textbox. How can do this if it is possible?I tryed using an object data type insted of the integer and double but it seems like object datatypes carnt be used within a class, because when I tried to use the control the VALUE property was disabled.

'PUBLIC PROPERTIES
Public Property Value() As Integer
Get[code].....

View 1 Replies

Set Properties Of A Class Only Through Constructor

Mar 1, 2010

I am trying to make the properties of class which can only be set through the constructor of the same class

View 7 Replies

Writing Data From Array In One Class To A Listbox In Another Class

Jul 26, 2011

I'm designing a small GUI Windows program that allow staff at a cinema to reserve seats for customers. There will be a total of 60 seats in the cinema. I have two classes in my program:-

1.) MainForm.vb - used for I/O actions and user interaction

2.) SeatManager.vb - used to hold and handle the background methods and functions that make the program work

Here is the code for my MainForm.vb class thusfar:-

Public Class MainForm
Private Const m_totalNumberOfSeats As Integer = 60
Private m_seatManager As SeatManager

[Code]....

Basically, when the program opens, the lstReservations list in the MainForm class will be populated with a total of 60 (m_totalNumberOfSeats) entries to represent 60 seats. Each of these seats will contain the index number from the array m_nameList; this index number (+1) will represent the seat number and then in the lstReservations list, after the seat number, I'd like it to contain the respective entry from the m_nameList array. As all entries will be held in RAM, when the GUI is opened, all m_nameList array entries will be empty. As the user uses the program, they can highlight a row in the lstReservations list and then use the GUI textboxes to enter the customer's name which will then be populated into the respective array entry.

how to, when the GUI opens, ensure that the lstReservations list takes all of the blank entries from the m_nameList array and from there, I can highlight a row to carry out further methods on?

View 1 Replies

Generic Class Array - Reading In A Excel File And Extract Data To Store In A Array

Sep 9, 2010

I want to reading in a excel file and extract the sCodenumber sDescription ans the sStatus and store them in a array : StatusComposeArray(5200) As MyCompose. After this I need this array for comparing outside this class. But as can you see the array is defined inside the sub: ReadingIn_ExcelFilesCompose [Code]

View 2 Replies

.net - Accessing Class Properties In Xaml?

Feb 18, 2010

I've currently created the class below. For some reason though I can't access the properties I've created through my xaml style.

Public Class Ribbon : Inherits Button
Private mpopDropdown As Popup
Public Property Dropdown() As Popup

[Code].....

but they don't seem to expose the property either. I've also tagged the property as <Bindable(True)> but that didn't seem to do anything.

View 2 Replies

.net - Class Definition Properties Or Methods?

Aug 4, 2010

I have a class definition that I've seen other define properties that return collections of objects.

Public Property GetAllAdults() as Adults End Property I made the argument that this should be a method in the class, because it doesn't define an attribute of the class, and could not be extended with parameters. Is/Are there reasons why this should be defined as a property vs. a function?

View 3 Replies







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