Saving & retrieving a multidimensional array to a file

Saving & retrieving a multidimensional array to file

Page 1 of 1

6 Replies - 11086 Views - Last Post: 11 June 2009 - 09:57 AM Rate Topic: -----

#1 KyleWoodbury  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 09-June 09

Saving & retrieving a multidimensional array to a file

Post icon  Posted 09 June 2009 - 07:07 PM

Hello,

I'm working on a project with a large multidimensional array

resrv(200,12,31,33) it keeps track of information on specific dates within a 200 year range.

What I'm looking to do is save the array to a file so that I can load it again when the program is started.

In VB 6 I used to be able to use a simple for next loop into an open file and load it the same way. It doesn't seem to work the same way with Fthe filestream class in VB.net


any help would be greatly appreciated.

This post has been edited by KyleWoodbury: 09 June 2009 - 07:08 PM


Is This A Good Question/Topic? 0
  • +

Replies To: Saving & retrieving a multidimensional array to a file

#2 June7  Icon User is offline

  • D.I.C Addict
  • member icon

Reputation: 104
  • View blog
  • Posts: 904
  • Joined: 09-December 08

Re: Saving & retrieving a multidimensional array to a file

Posted 10 June 2009 - 12:23 AM

You should post the code attempting to do the task and elaborate on error msgs encountered or otherwise explain how it is not working - wrong results, nothing happens.
Was This Post Helpful? 0
  • +
  • -

#3 Cookiesliyr  Icon User is offline

  • D.I.C Head

Reputation: 12
  • View blog
  • Posts: 136
  • Joined: 16-May 09

Re: Saving & retrieving a multidimensional array to a file

Posted 10 June 2009 - 01:59 PM

duuuuuuuuuuuuuuuuuuuuuuuuuuuuuude ..... making an array that big is really not a nice thing

do u know how the Rams feel when a program asks it to save a place for ur array ? i am sure not .......

there is always another way to do what do u want, do u wanna make a calendar program ? will save ur data as a string annnnnd save ur date for that data as a date , DON'T EVER EVER THINK ABOUT USING UR ARRAY PLLLLZZZ

it make me feel like i ate a whale or something when i take a look at ur array, u know when u declare such a thing ur ram will save for the data a very huge space while i am really sure ur array will mostly 80% of it empty.

will explain for me what are ur doing and i will try my best to find a help
Was This Post Helpful? 0
  • +
  • -

#4 KyleWoodbury  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 09-June 09

Re: Saving & retrieving a multidimensional array to a file

Posted 11 June 2009 - 08:11 AM

haha yeah that is bad isn't it. Yes I am making a calendar program for scheduling information. I'm guessing the best way would be to put it in a database but I am yet to get that to work the way I want as I am new to VB.net. The problem I have now is that I have built the whole program around this array. I could make the array much smaller (10, 12, 31, 33) which is still 122,760 spaces but I guess I should be back at the drawing board. Thanks for the wake up call =)
Was This Post Helpful? 0
  • +
  • -

#5 chrixko  Icon User is offline

  • D.I.C Head

Reputation: 16
  • View blog
  • Posts: 63
  • Joined: 25-November 08

Re: Saving & retrieving a multidimensional array to a file

Posted 11 June 2009 - 08:52 AM

Hello,

if its bad or not.. to save an array i would take a look at "Serialization"
Take a look in the msdn at :
BinaryFormatter
Serialization
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1  Icon User is online

  • Suitor #2
  • member icon



Reputation: 13493
  • View blog
  • Posts: 53,899
  • Joined: 12-June 08

Re: Saving & retrieving a multidimensional array to a file

Posted 11 June 2009 - 09:37 AM

Have you thought about moving to datasets? In theory you can "simulate" a database structure and it saves down to XML nodes in a snap.

Can you explain to us what the dimensions are for?

"resrv(200,12,31,33)"
Was This Post Helpful? 0
  • +
  • -

#7 baavgai  Icon User is offline

  • Dreaming Coder
  • member icon


Reputation: 6979
  • View blog
  • Posts: 14,605
  • Joined: 16-October 07

Re: Saving & retrieving a multidimensional array to a file

Posted 11 June 2009 - 09:57 AM

View Postmodi123_1, on 11 Jun, 2009 - 10:37 AM, said:

Have you thought about moving to datasets? In theory you can "simulate" a database structure and it saves down to XML nodes in a snap.

Can you explain to us what the dimensions are for?

"resrv(200,12,31,33)"


Looks like year, month, day, and 33 data points? Ouch.

Please, use a class. I'm breaking my personal rule against posting to a VB forum, but that's bloody horrendous.

Something like this, maybe:
Public Class ResrvItem
	Public dt As DateTime
	Public thing1 As Integer
	Public thing2 As Integer
	' etc
End Class

Public Class Resrv
	Public items As New List(Of ResrvItem)
End Class


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1