Please Help!! Arraylist of structures and textboxes

  • Thread starter Thread starter RBCC
  • Start date Start date
R

RBCC

I have the following structure:
Structure member
Dim name As String
Dim phone As String
End Structure

Dim memberarray As New ArrayList
Dim membership As member
********************
Ihave the following form:

a lstbox filled with the last,first of all the members
a textbox holding the names of all the members
a textbox holding the phone numbers of all the members

Now I am in the middle of writing code to modify the list of names, I
would like to use the arraylist to insert the contents of the textbox
into the arraylist, I have tried everything but the right thing.

Could someone show me the right way to do this so I can insert the
contents of the textbox in the 9th position of the arraylist?

john
 
I have the following structure:
Structure member
Dim name As String
Dim phone As String
End Structure

Dim memberarray As New ArrayList
Dim membership As member
********************
Ihave the following form:

a lstbox filled with the last,first of all the members
a textbox holding the names of all the members
a textbox holding the phone numbers of all the members

Now I am in the middle of writing code to modify the list of names, I
would like to use the arraylist to insert the contents of the textbox
into the arraylist, I have tried everything but the right thing.

Could someone show me the right way to do this so I can insert the
contents of the textbox in the 9th position of the arraylist?

john

I'm not quite sure what your asking... So, pardon me if I'm not exactly
on with the answer...

First of all, if your using an arraylist to store these things - loose
the structure. Structures are value types, and you'll suffer a
considerable performance hit if you insist on storing them in an
ArrayList, due to boxing conversions that have to take place.

That said, I would change the above to a class... (Warning, air code
follows!):

Class Member
Private _name As String
Private _phone As String

Public Sub New (ByVal Name As String, ByVal Phone As String)
Me._name = Name
Me._phone = Phone
End Sub

Public ReadOnly Property Name() As String
Get
Retrun Me._name
End Get
End Property

Public ReadOnly Property Phone() As String
Get
Return Me._phone
End Get
End Property

Public Overrides Overloads Function ToString()
Return me._Name
End Sub

End class

.....

' insert a member at the 9th position
memberList.Insert(aMember, 8)


If you give more details, I'm sure more (and probably more helpful)
information will be forth comming I'm sure :)

--
Tom Shelton [MVP]
Powered By Gentoo Linux 1.4
"`Ford, you're turning into a penguin. Stop it.'"

- Arthur experiences the improbability drive at work.
 
Back
Top