0 Replies - 5181 Views - Last Post: 13 May 2007 - 03:36 AM Rate Topic: -----

#1 Orann   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 13-May 07

Loading a 2D Array from a CSV File (And other Puzzling Problems)

Posted 13 May 2007 - 03:36 AM

First of all, Hello all.
This is my first post here in what seems to be a dynamic and helpful community. Having just been introduced into the wonderful world of Coding, I am jumping ahead probably too far for what I know (And, possibly more importantly, what My teacher knows). I seem to be grasping the concepts of coding naturally which is helping me move along, but in attempting to write a program for personal use I have run into a few difficulties.

What I need to do is load a .csv file (Apparently I am not able to attach a csv file on these forums. Anyway, the point I was trying to prove was that it is several thousand values in length, making it impractical to directly write into the code itself) into a 2 dimensional array in my program. The problem I am currently experiencing is that the information written into the array is not correct. In fact, it'snot even present in the file. My code currently is as follows:

'Opens light.csv as file "1"
FileOpen(1, "C:\light.csv", OpenMode.Input)
		Do While Not EOF(1)
			For IntRow = 0 To UBound(Light, 1)
				For intColumn = 0 To UBound(Light, 2)

					'Below ("input") is the code that I think is responsible_
					' for this error. 
					Input(1, Light(IntRow, intColumn))
				Next intColumn
			Next IntRow
'The "Do while not EoF" function is broken, I know. it's not something I'm 
'terribly bothered with right now as I'm still trying to fix the input. It's
'mainly there to stop overflow or to help it function more reliably if I turn
'the array dynamic in the future (I plan to)


As I noted above, I believe the actual line of code that is responsible for writing the data into the csv ("input") is responsible for this. Quite simply, I don't know what code to use in a situation like this.

In addition to this, there are several other questions my VB teacher was unable to answer for me;

1: At the top of light.csv there are declarations for what type of field each column of data is (I.E: Light(0,2) is "integer" or "single" etc.). How might I write this into the array?

2: I plan to draw a map of circles using the data in the csv files. how might I make any circles I draw slightly transparent?

Thanks for any help you can give me.

P.S: i know there are things missing and good functions I should be putting into that code, but for now, this is what I'm trying to limit myself to. I've been coding for about 6 weeks now, so it's probably not very good.

Is This A Good Question/Topic? 0
  • +

Page 1 of 1