Array Heaven

C

Cesar

Hey Guys. i'd really appreciate your help with this. I've got a VB.net program due on tuesday and i've hit a brick wall... it's a program that helps keep track room reservations for a hotel

I'm reading from a text file using streamreader (Import System.IO) and i'm having trouble understanding how it stores the information into an array. and how to pass the array between multiple forms.

I'm creating a search button that takes what the text file puts into an array and compare it to the available rooms for the hotel to see if there's vacancy or not. then display the valid results in a listbox.

I have the files available if somebody really wants to help out. i've got a good grasp on VB but i work well if i have example code that demonstrates a concept. so if there's a book out there or example file somebody has. that'd be great.

Attached is my vbcode for my frmmain... help would be great. thanks.

In Hoc
 
S

Scott M.

A streamReader doesn't store any data, nor does it work with arrays.

A streamReader simply reads streams of data from a source you specify. If you wish to store that data, you could store it into a string and then break the string up (using a string method such as "split" or "substring"), which do return arrays.

Once the data is stored in an array, it can be passed between form instances if it has been declared with "Friend" or "Public" scope.


Hey Guys. i'd really appreciate your help with this. I've got a VB.net program due on tuesday and i've hit a brick wall... it's a program that helps keep track room reservations for a hotel

I'm reading from a text file using streamreader (Import System.IO) and i'm having trouble understanding how it stores the information into an array. and how to pass the array between multiple forms.

I'm creating a search button that takes what the text file puts into an array and compare it to the available rooms for the hotel to see if there's vacancy or not. then display the valid results in a listbox.

I have the files available if somebody really wants to help out. i've got a good grasp on VB but i work well if i have example code that demonstrates a concept. so if there's a book out there or example file somebody has. that'd be great.

Attached is my vbcode for my frmmain... help would be great. thanks.

In Hoc
 
C

Cor Ligthert

Cesar,

When you want your data in an array, the best thing you can use is in my
opinion the arraylist.

Than you can read record by record the data by using readline, something as

\\\
Dim arrList as new ArrayList
Dim sr As StreamReader = New StreamReader(path)
Do While sr.Peek() >= 0
arrList.add(sr.ReadLine())
Loop
///

You can as well set it direct in the listbox, doing this, however mostly
will that slow up your program.

I hope this helps?

Cor

"Cesar" (e-mail address removed)
Hey Guys. i'd really appreciate your help with this. I've got a VB.net
program due on tuesday and i've hit a brick wall... it's a program that
helps keep track room reservations for a hotel

I'm reading from a text file using streamreader (Import System.IO) and i'm
having trouble understanding how it stores the information into an array.
and how to pass the array between multiple forms.

I'm creating a search button that takes what the text file puts into an
array and compare it to the available rooms for the hotel to see if there's
vacancy or not. then display the valid results in a listbox.

I have the files available if somebody really wants to help out. i've got a
good grasp on VB but i work well if i have example code that demonstrates a
concept. so if there's a book out there or example file somebody has.
that'd be great.

Attached is my vbcode for my frmmain... help would be great. thanks.
In Hoc
 
C

chanmmn

You should create a structure using keyword Type. Read in as a record is easy.

I have a sample in VB6 so have fun for migration and testing.

chanmm
Hey Guys. i'd really appreciate your help with this. I've got a VB.net program due on tuesday and i've hit a brick wall... it's a program that helps keep track room reservations for a hotel

I'm reading from a text file using streamreader (Import System.IO) and i'm having trouble understanding how it stores the information into an array. and how to pass the array between multiple forms.

I'm creating a search button that takes what the text file puts into an array and compare it to the available rooms for the hotel to see if there's vacancy or not. then display the valid results in a listbox.

I have the files available if somebody really wants to help out. i've got a good grasp on VB but i work well if i have example code that demonstrates a concept. so if there's a book out there or example file somebody has. that'd be great.

Attached is my vbcode for my frmmain... help would be great. thanks.

In Hoc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top