Trying to store a long long list of x y coordinates. This can be done in a comma delimted file and read into VB ....but I dont want to have a seperate file outside the exe file...
The string is eg. string = "300 400, 234 345, 233 235 "
Except the string is very very long series of co ordinates, I cannot simply cut and paste this into the code it seems it is far to long to include this way...
I would definitely use a Resource file, I would also not store them as a string, I would store them in an array of the appropriate numerical data type. Perhaps Integer, that would cover you if all the coords were within the range -32,768 to 32,767. It would take up much less memory and you could process the numbers much quicker.
I was thinking more on the lines of raw array data stored in an embedded *.RES.
That tutorial, as good as it is, is for making a custom resource file which presumably is not embedded into the executable. I'll post a little project with some embedded string and array data later tonight (GMT) if anyone is interested.
Edit: Embedded Res file example. I did not bother with any string data but I really think numbers should be stored as numbers. It's fairly crude but it should be enough to get you going. I enjoyed making it, I hope it helps.
These coords are mouse cursor movement coords, the res is loaded in as a string and split into an array.
..what I mean is that I can get it all working at the moment, with a RES file loading in as a string into VB and then converting it into a array. same as you hav
someone above said it is better to load it from the res as an integer?.. as it takes less memory space and generally handles better than if it was set as string type.
is this just a case of chaning :
From :
CoordString As String to CoordString As Integer ?..
CoordString As String to CoordString As Integer?..
Afraid not, CoordString As Integer will give you a single integer.
There are three bits of code posted here which I hope you can use/modify for your project. Two little projects in the attached zip and that snip just above. All the examples are using an array of a user defined type where each array element consists of two integers, X and Y. So in these same examples to find out what coordinate 17 was I could type debug.print iCoord(17).X, iCoord(17).Y
The above snip cuts a string up into an array of X and Y Integers, the first project in the zip saves these same arrays to disk, the second project extracts these arrays from the RES.