HighTechTalks DotNet Forums  

Help needed on Array's

Visual Studio.net (General) microsoft.public.vsnet.general


Discuss Help needed on Array's in the Visual Studio.net (General) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Peter Newman
 
Posts: n/a

Default Help needed on Array's - 06-25-2009 , 07:56 AM






VS2005, vb.net 2005 & SQL2005

Dispite reading various web pages, i am still confused and stuck.
I am looping in a flat file and extracting 3 peices of information per line
Name, Company , Service
the file will contain at least 1 line but an unlimited maximum lines. What
i need to do is load the information into an array / ArrayList to be able to
parm it to a function

I have looked at arraylist and structures, but to be honest im still just as
baffled. Can any one provide an example and explination?

Reply With Quote
  #2  
Old   
Nathan Sokalski
 
Posts: n/a

Default Re: Help needed on Array's - 06-25-2009 , 01:25 PM






What is it that yu are having trouble doing? Reading the file? Parsing the
lines? Not sure whether to use an Array, ArrayList, or other type? Please be
more specific about your question.
--
Nathan Sokalski
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/

"Peter Newman" <PeterNewman (AT) discussions (DOT) microsoft.com> wrote

Quote:
VS2005, vb.net 2005 & SQL2005

Dispite reading various web pages, i am still confused and stuck.
I am looping in a flat file and extracting 3 peices of information per
line
Name, Company , Service
the file will contain at least 1 line but an unlimited maximum lines. What
i need to do is load the information into an array / ArrayList to be able
to
parm it to a function

I have looked at arraylist and structures, but to be honest im still just
as
baffled. Can any one provide an example and explination?

Reply With Quote
  #3  
Old   
Peter Newman
 
Posts: n/a

Default Re: Help needed on Array's - 06-25-2009 , 01:56 PM



Hi,

My problem is i am reading a file containing anything from 1 to 500 lines.
Each of the lines (records ) will contain three peices of information that i
need to load into an array. ie Name, Company , Service. As I dont know how
many records will eb in the file I thought the best way was to load the info
into an array. I can then step through array index and load the data into a
function. I can not do this whilst reading the file so have to store the info
until I have closed the read on the file. After looking on various web pages,
it would appear that the best way to do this is to use a multidimential array
list. I am looking for advice and help on the best way to do this

"Nathan Sokalski" wrote:

Quote:
What is it that yu are having trouble doing? Reading the file? Parsing the
lines? Not sure whether to use an Array, ArrayList, or other type? Please be
more specific about your question.
--
Nathan Sokalski
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/

"Peter Newman" <PeterNewman (AT) discussions (DOT) microsoft.com> wrote in message
news:32B19292-4101-469D-B6B6-FFDEEDC43BC4 (AT) microsoft (DOT) com...
VS2005, vb.net 2005 & SQL2005

Dispite reading various web pages, i am still confused and stuck.
I am looping in a flat file and extracting 3 peices of information per
line
Name, Company , Service
the file will contain at least 1 line but an unlimited maximum lines. What
i need to do is load the information into an array / ArrayList to be able
to
parm it to a function

I have looked at arraylist and structures, but to be honest im still just
as
baffled. Can any one provide an example and explination?



Reply With Quote
  #4  
Old   
PvdG42
 
Posts: n/a

Default Re: Help needed on Array's - 06-25-2009 , 06:05 PM



"Peter Newman" <PeterNewman (AT) discussions (DOT) microsoft.com> wrote

Quote:
VS2005, vb.net 2005 & SQL2005

Dispite reading various web pages, i am still confused and stuck.
I am looping in a flat file and extracting 3 peices of information per
line
Name, Company , Service
the file will contain at least 1 line but an unlimited maximum lines. What
i need to do is load the information into an array / ArrayList to be able
to
parm it to a function

I have looked at arraylist and structures, but to be honest im still just
as
baffled. Can any one provide an example and explination?
What language are you using? You ask for examples, and it would make sense
if any examples provided were in the language you are using.

The ArrayList class defines a collection that can expand to hold any data
you want to store in it, so (compared to an Array, as you only mentioned
those two collections) that makes it a better choice for your needs as
you've described so far.

Yes, a struct may well be a good choice for your three fields. When you
define a struct, you are defining a new type to your language compiler, so
you can then create an ArrayList that holds multiple instances of your new
type.

What datatype are each of the three fields you want to store? How will the
sets of fields you want to use as arguments be stored in your collection?
Any particular order? How will the field sets be accessed for method calls?
Sequentially from the beginning of the collection?

All these questions need to be answered if you hope to get any good
examples.

Unlimited records on the input file? You must have some idea of the
potential high limit. If the number of records is really potentially huge,
that too will influence what makes sense as a solution design.

Reply With Quote
  #5  
Old   
Peter Newman
 
Posts: n/a

Default Re: Help needed on Array's - 06-26-2009 , 04:44 AM



Hi PvdG42
Thanks for the reply,

The language is vb.net 2005. The data types are strings , Name, Company ,
Service and it would be simpler if they were stroed in that order, and will
be acc accessed sequentially from the beginning of the collection. As far as
the file goes, there will be a mimimum of 1 record in the file, with an
esitmated maximum of about 200. I hope this helps in being able to give
advice and examples of the best way to handle this

regards
"PvdG42" wrote:

Quote:

"Peter Newman" <PeterNewman (AT) discussions (DOT) microsoft.com> wrote in message
news:32B19292-4101-469D-B6B6-FFDEEDC43BC4 (AT) microsoft (DOT) com...
VS2005, vb.net 2005 & SQL2005

Dispite reading various web pages, i am still confused and stuck.
I am looping in a flat file and extracting 3 peices of information per
line
Name, Company , Service
the file will contain at least 1 line but an unlimited maximum lines. What
i need to do is load the information into an array / ArrayList to be able
to
parm it to a function

I have looked at arraylist and structures, but to be honest im still just
as
baffled. Can any one provide an example and explination?

What language are you using? You ask for examples, and it would make sense
if any examples provided were in the language you are using.

The ArrayList class defines a collection that can expand to hold any data
you want to store in it, so (compared to an Array, as you only mentioned
those two collections) that makes it a better choice for your needs as
you've described so far.

Yes, a struct may well be a good choice for your three fields. When you
define a struct, you are defining a new type to your language compiler, so
you can then create an ArrayList that holds multiple instances of your new
type.

What datatype are each of the three fields you want to store? How will the
sets of fields you want to use as arguments be stored in your collection?
Any particular order? How will the field sets be accessed for method calls?
Sequentially from the beginning of the collection?

All these questions need to be answered if you hope to get any good
examples.

Unlimited records on the input file? You must have some idea of the
potential high limit. If the number of records is really potentially huge,
that too will influence what makes sense as a solution design.




Reply With Quote
  #6  
Old   
Nathan Sokalski
 
Posts: n/a

Default Re: Help needed on Array's - 06-26-2009 , 08:59 PM



Another thing that may affect what you want is the type accepted by the
function you say you want to pass it to (would you be able to give us the
signature of the function?). If you plan to write this function yourself,
then it probably won't make much of a difference.
--
Nathan Sokalski
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/

"Peter Newman" <PeterNewman (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi PvdG42
Thanks for the reply,

The language is vb.net 2005. The data types are strings , Name, Company ,
Service and it would be simpler if they were stroed in that order, and
will
be acc accessed sequentially from the beginning of the collection. As far
as
the file goes, there will be a mimimum of 1 record in the file, with an
esitmated maximum of about 200. I hope this helps in being able to give
advice and examples of the best way to handle this

regards
"PvdG42" wrote:



"Peter Newman" <PeterNewman (AT) discussions (DOT) microsoft.com> wrote in message
news:32B19292-4101-469D-B6B6-FFDEEDC43BC4 (AT) microsoft (DOT) com...
VS2005, vb.net 2005 & SQL2005

Dispite reading various web pages, i am still confused and stuck.
I am looping in a flat file and extracting 3 peices of information per
line
Name, Company , Service
the file will contain at least 1 line but an unlimited maximum lines.
What
i need to do is load the information into an array / ArrayList to be
able
to
parm it to a function

I have looked at arraylist and structures, but to be honest im still
just
as
baffled. Can any one provide an example and explination?

What language are you using? You ask for examples, and it would make
sense
if any examples provided were in the language you are using.

The ArrayList class defines a collection that can expand to hold any data
you want to store in it, so (compared to an Array, as you only mentioned
those two collections) that makes it a better choice for your needs as
you've described so far.

Yes, a struct may well be a good choice for your three fields. When you
define a struct, you are defining a new type to your language compiler,
so
you can then create an ArrayList that holds multiple instances of your
new
type.

What datatype are each of the three fields you want to store? How will
the
sets of fields you want to use as arguments be stored in your collection?
Any particular order? How will the field sets be accessed for method
calls?
Sequentially from the beginning of the collection?

All these questions need to be answered if you hope to get any good
examples.

Unlimited records on the input file? You must have some idea of the
potential high limit. If the number of records is really potentially
huge,
that too will influence what makes sense as a solution design.




Reply With Quote
  #7  
Old   
Peter Newman
 
Posts: n/a

Default Re: Help needed on Array's - 06-27-2009 , 07:40 AM



Hi Nathan,

The function I need to write, will i suppose depend on how i store the data,
be in an array or arraylist. The function will need to read through the array
/ array list starting at index 0 . I will get the three parts of information
and then parm the data to a SQL Stored Procedure. I am intending to step
through the array / arraylist index untill there array(index) value is empty.

Hope that makes sense

"Nathan Sokalski" wrote:

Quote:
Another thing that may affect what you want is the type accepted by the
function you say you want to pass it to (would you be able to give us the
signature of the function?). If you plan to write this function yourself,
then it probably won't make much of a difference.
--
Nathan Sokalski
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/

"Peter Newman" <PeterNewman (AT) discussions (DOT) microsoft.com> wrote in message
news:B840A1E9-C91B-449B-9171-8BECA3E3843B (AT) microsoft (DOT) com...
Hi PvdG42
Thanks for the reply,

The language is vb.net 2005. The data types are strings , Name, Company ,
Service and it would be simpler if they were stroed in that order, and
will
be acc accessed sequentially from the beginning of the collection. As far
as
the file goes, there will be a mimimum of 1 record in the file, with an
esitmated maximum of about 200. I hope this helps in being able to give
advice and examples of the best way to handle this

regards
"PvdG42" wrote:



"Peter Newman" <PeterNewman (AT) discussions (DOT) microsoft.com> wrote in message
news:32B19292-4101-469D-B6B6-FFDEEDC43BC4 (AT) microsoft (DOT) com...
VS2005, vb.net 2005 & SQL2005

Dispite reading various web pages, i am still confused and stuck.
I am looping in a flat file and extracting 3 peices of information per
line
Name, Company , Service
the file will contain at least 1 line but an unlimited maximum lines.
What
i need to do is load the information into an array / ArrayList to be
able
to
parm it to a function

I have looked at arraylist and structures, but to be honest im still
just
as
baffled. Can any one provide an example and explination?

What language are you using? You ask for examples, and it would make
sense
if any examples provided were in the language you are using.

The ArrayList class defines a collection that can expand to hold any data
you want to store in it, so (compared to an Array, as you only mentioned
those two collections) that makes it a better choice for your needs as
you've described so far.

Yes, a struct may well be a good choice for your three fields. When you
define a struct, you are defining a new type to your language compiler,
so
you can then create an ArrayList that holds multiple instances of your
new
type.

What datatype are each of the three fields you want to store? How will
the
sets of fields you want to use as arguments be stored in your collection?
Any particular order? How will the field sets be accessed for method
calls?
Sequentially from the beginning of the collection?

All these questions need to be answered if you hope to get any good
examples.

Unlimited records on the input file? You must have some idea of the
potential high limit. If the number of records is really potentially
huge,
that too will influence what makes sense as a solution design.







Reply With Quote
  #8  
Old   
Nathan Sokalski
 
Posts: n/a

Default Re: Help needed on Array's - 06-27-2009 , 11:43 AM



What does the SQL Stored Procedure do? The reason i am asking is because if
the SQL Stored Procedure is being used to add the data to a database, you
really have no need to create an array or arraylist (or any other object) to
store the data in. Is there a specific reason you want to create an extra
object (sometimes there can be a reason, but it will help if you let us know
what it is)?
--
Nathan Sokalski
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/

"Peter Newman" <PeterNewman (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi Nathan,

The function I need to write, will i suppose depend on how i store the
data,
be in an array or arraylist. The function will need to read through the
array
/ array list starting at index 0 . I will get the three parts of
information
and then parm the data to a SQL Stored Procedure. I am intending to step
through the array / arraylist index untill there array(index) value is
empty.

Hope that makes sense

"Nathan Sokalski" wrote:

Another thing that may affect what you want is the type accepted by the
function you say you want to pass it to (would you be able to give us the
signature of the function?). If you plan to write this function yourself,
then it probably won't make much of a difference.
--
Nathan Sokalski
njsokalski (AT) hotmail (DOT) com
http://www.nathansokalski.com/

"Peter Newman" <PeterNewman (AT) discussions (DOT) microsoft.com> wrote in message
news:B840A1E9-C91B-449B-9171-8BECA3E3843B (AT) microsoft (DOT) com...
Hi PvdG42
Thanks for the reply,

The language is vb.net 2005. The data types are strings , Name, Company
,
Service and it would be simpler if they were stroed in that order, and
will
be acc accessed sequentially from the beginning of the collection. As
far
as
the file goes, there will be a mimimum of 1 record in the file, with an
esitmated maximum of about 200. I hope this helps in being able to give
advice and examples of the best way to handle this

regards
"PvdG42" wrote:



"Peter Newman" <PeterNewman (AT) discussions (DOT) microsoft.com> wrote in
message
news:32B19292-4101-469D-B6B6-FFDEEDC43BC4 (AT) microsoft (DOT) com...
VS2005, vb.net 2005 & SQL2005

Dispite reading various web pages, i am still confused and stuck.
I am looping in a flat file and extracting 3 peices of information
per
line
Name, Company , Service
the file will contain at least 1 line but an unlimited maximum
lines.
What
i need to do is load the information into an array / ArrayList to be
able
to
parm it to a function

I have looked at arraylist and structures, but to be honest im still
just
as
baffled. Can any one provide an example and explination?

What language are you using? You ask for examples, and it would make
sense
if any examples provided were in the language you are using.

The ArrayList class defines a collection that can expand to hold any
data
you want to store in it, so (compared to an Array, as you only
mentioned
those two collections) that makes it a better choice for your needs as
you've described so far.

Yes, a struct may well be a good choice for your three fields. When
you
define a struct, you are defining a new type to your language
compiler,
so
you can then create an ArrayList that holds multiple instances of your
new
type.

What datatype are each of the three fields you want to store? How will
the
sets of fields you want to use as arguments be stored in your
collection?
Any particular order? How will the field sets be accessed for method
calls?
Sequentially from the beginning of the collection?

All these questions need to be answered if you hope to get any good
examples.

Unlimited records on the input file? You must have some idea of the
potential high limit. If the number of records is really potentially
huge,
that too will influence what makes sense as a solution design.







Reply With Quote
  #9  
Old   
PvdG42
 
Posts: n/a

Default Re: Help needed on Array's - 06-28-2009 , 07:19 PM



"Peter Newman" <PeterNewman (AT) discussions (DOT) microsoft.com> wrote

Quote:
Hi Nathan,

The function I need to write, will i suppose depend on how i store the
data,
be in an array or arraylist. The function will need to read through the
array
/ array list starting at index 0 . I will get the three parts of
information
and then parm the data to a SQL Stored Procedure. I am intending to step
through the array / arraylist index untill there array(index) value is
empty.

Hope that makes sense

I have created a simple demo with code that may be helpful, but the solution
is VS 2008 (I haven't used 2005 in a long time), so it won't open for you. I
can send the source code files and a description of the form if you care to
provide an email address.

Reply With Quote
  #10  
Old   
eBob.com
 
Posts: n/a

Default Re: Help needed on Array's - 06-29-2009 , 08:40 AM



PvdG42,

A "simple demo" can't be a lot of code, maybe you could post it here for
everyone's benefit.

Bob


"PvdG42" <pvdg (AT) toadstool (DOT) edu> wrote

Quote:

"Peter Newman" <PeterNewman (AT) discussions (DOT) microsoft.com> wrote in message
news:3E47CB1B-FF30-41CA-B93F-D80D90FD0D4C (AT) microsoft (DOT) com...
Hi Nathan,

The function I need to write, will i suppose depend on how i store the
data,
be in an array or arraylist. The function will need to read through the
array
/ array list starting at index 0 . I will get the three parts of
information
and then parm the data to a SQL Stored Procedure. I am intending to step
through the array / arraylist index untill there array(index) value is
empty.

Hope that makes sense

I have created a simple demo with code that may be helpful, but the
solution is VS 2008 (I haven't used 2005 in a long time), so it won't open
for you. I can send the source code files and a description of the form if
you care to provide an email address.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.