Simple but extended ....
For i = 0 To NoOfImages
Put #nFileNum, , Image1(i).Width
Put #nFileNum, , Image1(i).Height
Put #nFileNum, , Image1(i).etc....
Then read all the properties... read width, read height, ... the only problems is to write some properties like images.
You could write a Serializable method of the class of your control to write to a stream of data (open file in vb6) ... and in the future it will work with .NET (with some modifications).
: : I'm a beginner in VB programming so I apologize if my questions are not appropriate (stupid, in other words:) ).
: : I'm making some kind of flowchart program. Each box is an image control. They are connected with lines drawn by line method. All of these 'objects' are clickable, and on user click the dialog box appears to get some user input that defines the 'object'.
: : The question at last, what is the best way to save this to a file? I've tried with making binary file that has some application recognizable extension, but the problem is how to put the data about the type of the image, its position, picture etc. in it.
: : I was hoping that simple code like:
: : For i = 0 To NoOfImages
: : Put #nFileNum, , Image1(i)
: : Next i
: : would work, but I get an error, can't put an object reference variable.
: The Image1 array is just an array of Image controls. If you want to store the actual pictures in your file then you'll have to open the image files and copy their contents to your file, but that seems like a lot of extra work to do for very little benefit. The way you save your data should be (IMO) independent of how you present it. What if you update your program with fancier images? What if you want to output it in a text-only form? Personally I would use XML, but you could certainly use any format you like. Something like this might be useful:
: <?xml version="1.0"?>
: <box id="1" type="start" x="50" y="100" caption="Start"/>
: <box id="2" type="decision" x="100" y="100" caption="Y/N?"/>
: <box id="3" type="end" x="150" y="100" caption="End"/>
: <box id="4" type="done" x="100" y="150" caption="Done"/>
: <arrow from-id="1" to-id="2"/>
: <arrow from-id="2" to-id="3" caption="N"/>
: <arrow from-id="2" to-id="4" caption="Y"/>
: Using XML means you'll never have to worry about losing your data in a binary format you've forgotten. You can read it yourself an get an idea about what it represents. You can also use XSLT, for example, to transform the above XML file into an SVG image or something else.
: Your program itself, as the presentation layer, is the part responsible for displaying the appropriate image for each item.
: Something I just thought of too, the hypothetical data as I've represented it above is a classic graph data type (a set of nodes and a set of arcs), meaning you could potentially utilize graph algorithms to analyze whatever flows might be represented to find the shortest paths, or weighted averages, etc. That might be interesting or not, just thought I'd mention it.
: $ select * from users where clue > 0
: no rows returned