Making An Array Of A Class?

Oct 29, 2007

I was wondering if it was possible to make an array of a class. I made a class called creatures (for a game of course) and wanted to make an array of that class. So I tried "public creature() as new creatures", and it had a problem with using an array with new. Is there a way around this. All I am using the class for is variables. i.e.: in my class all i have is dim health, defense

View 12 Replies


ADVERTISEMENT

VS 2010 - Array SubString (of Sorts) / Making A Class That Represents A File?

Feb 24, 2011

Im making a class that represents a file. Im making a sub that reads data from one byte array into many properties. Now i need something that returns a byte array but only the first 4. Let me demonstrate because i can't think of a logical way of explaining. "something".substring(0,3) That would return a string containing "som" i need a function like that for a byte array


[code]...

Is there an existing function for this type of thing ? i've looked but didn't see anything that I understood.

View 2 Replies

Interface And Graphics :: Making A Custom Class That Mocks The System.Drawing.Rectangle Class?

Jul 6, 2010

I'm making a custom class that mocks the System.Drawing.Rectangle class because the Rectangle class doesn't have a name property. I need a name property because I am adding all of my rectangles to a collection and I need a little more info stored than just their locale and size. So I changed the _onPaint event but nothing is working out when I run the program?

Public Class Rectanglar : Inherits UserControl
Public BackgroundColor As Color = Color.Blue
Public Sub New(ByVal name As String, ByVal XY As Point, ByVal Widthy As Integer, ByVal Heighty As Integer)

[code].....

View 5 Replies

VS 2008 : Making An Array = Another Array?

Nov 2, 2010

I have 2 arrays, tile(13,6) and loc1tile(13,6). Is there a way to make the values in loc1tile(13,6) equal to the corresponding values of tile(13,6)?Do I have to do it like this?

loc1tile(0,0) = tile (0,0)
loc1tile(0,1) = tile (0,1)
loc1tile(0,2) = tile (0,2)
etc.....

View 7 Replies

Making A .dll From Class.vb Files?

Mar 10, 2009

I am using visual studio express edition 2008. I am trying to move my class.vb files in my web application to one .dll. I used visual express edition 2005 earlier and I had to add to import the below code to get it to work. Now in 2008 edition I get a whole new error and I need to know what I need to Import. Code is below

2005:
Imports Microsoft.VisualBasic
Imports System.Configuration
Imports System.Web

When I do the above in 2008 I get the following errors:

Shared mainconnection As
New Data.OleDb.OleDbConnection(ConfigurationManager.ConnectionStrings("connectionstring").ConnectionString)
Error: Error 1 Name 'ConfigurationManager' is not declared.

[code]....

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

Making A Blackjack Game For Class?

May 2, 2011

I'm making a blackjack game for class. It's been better programming in VB than it has in C#, but I don't know how to link button subs (BTN_Deal_Click or BTN_Deal; I can't decide which one will work) to one another. For example, after the code in BTN_Deal has been run, the program is supposed to wait for the user to click either the Hit or the Stand button.

[Code]...

View 2 Replies

Making Variable Class With Event?

Jun 22, 2010

I haven't quote grasped this whole "class" concept yet, but I'm working on it. When following the instructions below, the "test" portion of this code: "test.variable". It has an underlined error that says that "test" is not declared. If I remove the "test" word then the ".variable" shows not declared. I'm using Visual Studios 8 if that makes any difference. I have a pre-existing variable in a project that I would like to monitor for changes.

Re: Detect variable change.
Make your variable a class with an event.
Make your class:
VB.NET Syntax (Toggle Plain Text)
Public Class myVar
Private mValue As Integer
Public Event VariableChanged(ByVal mvalue As Integer)
[Code] .....

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

Convert C# Class's Byte Array Values Into Integer Array?

Jun 22, 2010

A c# class's single dimension byte array contains socket level instrument sensor data as per:

public static byte[] frameData

View 9 Replies

Creating An Array Of A Class, And An Array In The Class?

Jan 20, 2009

It's been a LONG time since I messed with VB, and I'm messing around with VB 2008 now.I'm trying to make a custom class with three variables,

ID (String)
Title (String)
Comments (Array of String)

[code]......

View 3 Replies

Class For Making Object Visible.False

Dec 21, 2011

I am trying to make a customer class that will simply make a bunch of controls (hotspots) Visible value = False.

For instance: WinStartSpot.visible = False

Thing is I have roughly 60 "spots" that need to be turned on and off as the user clicks through the program (its a very simple OS simulator) I tried to make a class using boolean return but that failed miserably. how to code a class like that?

View 7 Replies

Making A Property Into An Array?

Oct 31, 2010

This is my code for a class named Gun

Private GetCapacity As Integer
GetCounter As Integer
Private GetPosition As TV3D65.TV_3DVECTOR
'Make ".Property"'s called capacity, outofammo, etc..
Property Capacity As Integer

[Code]...

View 2 Replies

Making An Array Through A File?

Dec 1, 2009

is there a way to make an array but instead of listing the things yourself, you open a text file with a bunch of words and use those?

View 3 Replies

Difference Between Using The 'array' Class In VB And Just Declaring An Array Like Normal?

Mar 12, 2010

What is the difference between using the 'array' class in VB and just declaring an array like normal. In other words, what is the difference between:

Dim numOfTicketsPerDay As Array
Dim intNumOfTicketsPerDay(6)
As Integer

Is there any preference of when one should be used over another?

View 2 Replies

Transferring A Form Array Into A Private Class Array?

Mar 15, 2010

If I make the following array in a push button event and I want to put those array variables in a class array. How do I do that? I am just beginning to learn about classes in vb.net but I am having problems using classes and arrays.Is there any good tutorials on that subject.

[Code]...

View 7 Replies

Create An UnInterface Making Sure That The Class Does Not Have A Method / Property

Dec 17, 2009

Interface makes sure a class does have a Method / Property, However is there a way to create an unInterface, making sure that the class does not have a method / property or is there a way to implement something that will unimplement every other implements except for itself?

what i want to do: i've got a class that serves as a storage for information only, so i decided to give it a blank interface IBank, the other classes that share this feature will implement this interface. they should not implement any other interface the use is that when i seek out the interface of a class and realise that its IBank i know that its just a class for info storage.

View 1 Replies

Making Sprite Class And Cycling Through Image Arrays

Feb 2, 2012

I am using vb.net by the way. From what I understand, Xna is not usable in visual Basic. Therefore, in order to create my characters, I defined a sprite class. Now my question is.... (I am drawing everything using a timer on the form btw by the process of invalidation.)... how do I use time to cycle through the images in an image array while the instance has no focus, and whilst the class inherits the "Control" class? Basically, how do i get these instances to act without user input? I want a character to eventually respond to user input, but I also need npcs that do not need any input in order to move themselves. Also, I need this in such a way that each instance's processes do NOT interfere with the processes of others. So that whatever timing I use does not also stall the whole window/form.

View 2 Replies

Methods Access Level - Making Public For Only One Class

Mar 20, 2009

I have a class which has various methods that I need to make public to only 1 other class. Is this possible? I don't want to make them public for everybody, just that 1 class.

View 1 Replies

VS 2008 Making Property In A Class Expose An ENUM?

Jul 12, 2009

I've got this in a public module

Module PublicModule
Public caseBAL_C As caseBAL
Public clientBAL_C As clientBal
Public Enum CSFlags

[Code]...

It doesn't like the Public Property StateFlag() As CSFlags -it's saying that CSFlags

'StateFlag' cannot expose type 'PublicModule.CSFlags' outside the project through class 'caseBAL'.

View 2 Replies

Array In One Class Writing To A List In Another Class?

Jun 3, 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:-

[Code]...

View 5 Replies

Forms :: Initialization Of An Array Of A Class Within A Class?

Nov 3, 2011

I have main class of Races with mulitple properties. One of those properties has been defined as another class Runners.

So I have a race with multiple runners and when I try to update the data i get an instantiation error.

For the life of me I can't get it to work.

This is what I am trying to do...

In the clsRace class I have defined :
PublicProperty clsRunner(ByVal index AsLong) As clsRunner
Get

[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

Making An Array Of Pictureboxes At Runtime?

May 22, 2010

im making an array of pictureboxes at runtime:

Dim picEnemy(9) As PictureBox
Dim enemysprite As Image
enemysprite = Image.FromFile("....gif")

[Code]....

i get the error:Object reference not set to an instance of an object.

now i know the error would be solved if i had:

dim picEnemy as New Picturebox, but i cant since its an array

View 3 Replies

C# - Create A Reference Of String Class Without Making A Object Of It And Start Using It?

Sep 6, 2010

String s = "test"; String is a class, so to use it we should create an object of it. But rather we just make a reference of it and give it a value. How is it possible and what concepts are used in it. The metadata of String class shows the following :

[Code]...

View 1 Replies

Making A General Functions Class Library That Will Be Used In Several Applications And Asp Pages?

Jul 12, 2009

making a general functions class library that will be used in several applications and asp pages, sometimes running at the same time.I've looked at a lot of samples on the web and they all show you to create an instance of the classlibrary namespace or the classlibrary class.

IE.
dim obj2 as new mycompany.mynamespace.myclass
dim n2 as integer
n2 = obj2.somefunction(...)

What I did was create my class library and put a class in it and declared a function as sharred, then created my dll.I don't have to create an instance of it and I can use it like the net framework by just coding

n2 = mycompany.mynamespace.myclass.somefunction(...).

The net framework does this, I mean once I imports it I don't have to make an instance of it in every function.All the samples I've seen about class libraries do not use the shared keyword.

View 1 Replies

Making Array Display In Ascending Order

Dec 12, 2011

so this code works for making my array display in ascending order but i cant figure out how to make it work in descending order

[Code]...

View 3 Replies

Making Image Array Using Project Resources

Apr 18, 2009

I need to make an array of images using references to the resources folder. The following is my code which does not work:
Dim imgPictures(8) As Image
imgPictures(0) = Image.FromFile(My.Resources.cat_1.ToString)
How do I reference the images sitting in the resources folder for this task?

View 4 Replies

Does Making A Class NotInheritable In .NET Offer The Same (potential) Compiler Optimizations As Sealed In C#?

Jan 11, 2010

I've read that making a class sealed in C# is advisable in high-performance scenarios because it frees the compiler to make certain optimizations (e.g., inlining property getters) that it wouldn't be able to make otherwise. Is the same true for NotInheritable in VB.NET?

View 1 Replies







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