Im trying to write a code, at the moment I have numbers being generated into 6 labels I then have a "save to history" cmd button with the idea that the captions of the labels are added onto a spreadsheet on the form. (either excell, msflexgrid or anyother it doesn't matter)
so I need to;
1. have a spread sheet ideally with 0 rows and 6 colums
2. when the "save to history" button is clicked....
----------- add a new row.
----------- display Lblnumber(1).caption in cell A1,Lblnumber(2).caption in cell b1,ect.
----------- save the sheet.
Idealy the spread sheet will be an object on the form rather than a seperate file.
Ive tried msflexgrid and found it easier to add rows change collum size, ect. but I cannot work out how to get the label captions onto it correctly (i managed to get 1 cell to display 1 label.caption but then couldn't add the others).
I havent got a clue with the excell sheet!
So please Help Im sure this is really easy stuff to anyone used to VB 6.0
To use an Excel sheet means to be restricted to computers which have Excel installed. Excel libraries are not redistributable.
The MSHFlexGrid, however, is. A program using FlexGrid can be installed on any other computer.
The cell's texts of a flexgrid are organized as a matrix in the TextMatrix property.
You must have at least one row to access this property.
Assumed your control is named 'flex' then you can do
Dim c%, r%
r = TheRowYouWanttoFill
For c=0 To 5 'having 6 columns
flex.TextMatrix(r, c) = LabelNumber(c).Caption
To add a row to the grid you simply increment the .Rows property.