473,379 Members | 1,220 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,379 software developers and data experts.

Please Help!! Arraylist of structures and textboxes

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
Nov 20 '05 #1
1 1302
On 2004-02-19, RBCC <pu************@email.com> wrote:
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.
Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: David Goodyear | last post by:
At the moment im experimenting with ideas in C++ and would really like to solve the following, please please help. Sorry i dont even know what the subject is this would come under? :( Sorry if...
4
by: almurph | last post by:
Hi, Hope I have the right forum here - apologies if I don't. I'm trying to access a ArrayList collection via an indexer inside a class called "collExample" What I want to be able to do is to...
3
by: RBCC | last post by:
I recently wrote this code, it lists the account numbers but the textboxes are empty what is the problem? I can't seem to get it. Dim trans_counter As Integer Dim trans_read() As String Do...
2
by: RBCC | last post by:
I have a form with a 2 textboxes and a listbox, The data is read in by a file called "memberphones" The listnbox lists names in this way (lastname,first name) sorted by the last name. the...
2
by: Tiraman :-\) | last post by:
Hi Everyone, i have the following problem in my client-server Application My server take array and serialize it into the memorystream Dim ns As NetworkStream = client.GetStream() Dim writer...
3
by: osp | last post by:
hi to every one.... i just started out with c++ and i think i am doing well.i use Robert Laffore to study. which book should i use for data structures ? please help. thank you with regards ...
8
by: skumar434 | last post by:
i need to store the data from a data base in to structure .............the problem is like this ....suppose there is a data base which stores the sequence no and item type etc ...but i need only...
6
by: selvakumari | last post by:
i am getting an exception while end editing the 1st column 1st row of the cell(1,1) it is a combobox cell of datagridview everytime it showing following exception only on endedit dont know why...
8
by: adarshyam | last post by:
hi.. I am new to vb.net i am doing a program using dynamic textboxes which involves two pages .. where values of textboxes in one page must be transfered to to other sex of textboxes in another page,...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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...
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...

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.