473,387 Members | 1,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

arrays in a custom class

2
Hi all.
First of all i want to say that i'm very new to vb.net (2008) so sorry if this is a stupid question.
I can't figure out why this does not work.

Public arrs(32) As ARR

Public Class ARR
Public nr As Integer
Public name As New String(New Char(17) {})
End Class

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Dim i As Integer

For i = 0 To 32
If arrs(i).nr = Nothing Then
arrs(i).nr = something
arrs(i).name = "something"
Exit For
End If
Next i
End Sub


Thanks for any help on this issue
Feb 14 '09 #1
2 983
What error do you get?
Feb 14 '09 #2
Rooo
2
Never mind...it's solved now.
I didn't initialize each element in the array before the read/write part.

Thanks anyway :-)


For n As Integer = 0 To arrs.Length - 1
arrs(n) = New ARR
Next

Dim i As Integer
Dim something As Integer = 14

For i = 0 To 32
If arrs(i).nr = Nothing Then
arrs(i).nr = something
arrs(i).name = "something"
Exit For
End If
Next i
Feb 15 '09 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

11
by: - Steve - | last post by:
For a school assignment I need to write a class to work with the following code. The IntArray b(-3, 6) basically means that I need to produce an array of integer values that has an index going...
0
by: raj | last post by:
Hey all I have a base class that manages (Manager_class) different shapes. It has different arrays of Circle_class, Square_class and etc etc. All the shapes have a common base class...
21
by: Matteo Settenvini | last post by:
Ok, I'm quite a newbie, so this question may appear silly. I'm using g++ 3.3.x. I had been taught that an array isn't a lot different from a pointer (in fact you can use the pointer arithmetics to...
7
by: Joseph Lee | last post by:
Hi All, I am having problem when i am using hashtable to keep an array of bytes value as keys. Take a look at the code snippet below --------------------------------------------------- ...
0
by: Martin Brunner | last post by:
Hi there, I have to use a C#-Library from Excel VBA. This __works__ fine over COM (Reference to the .tlb, that is created by .NET, out of VBA). But only __without__ in C#1 __With__, for...
38
by: ssg31415926 | last post by:
I need to compare two string arrays defined as string such that the two arrays are equal if the contents of the two are the same, where order doesn't matter and every element must be unique. ...
5
by: Sadeq | last post by:
Is it possible to define custom attributes for arrays? And if so, how can I retrieve them? I mean I want to define sth like: int MyArray; and then retrieve the value of the custom...
3
by: Zenon | last post by:
I have a function which returns array of structs. I need to create a collection of those arrays and thought that an ArrayList would be a good way to do this since the count is variable. The...
0
by: dph5010 | last post by:
I'm trying to make an object that will reflect the response from isbndb.com's API so I can serialize the results into my code. Right now I have code that works, however, the structure isn't quite the...
0
by: colin | last post by:
Hi, I have my property editor working for my custom classes and struct using typeconverters and generting propertydescriptors for the custom fields and data fields etc, ... when I edit an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.