I have some questions regarding the ading and editing of cell data using the report control that I am hoping someone can help with.
In your other controls you have the theme of being able to create an item and assign it your own id so you later access it. eg with the Docking pane I have used code like this Public Const ID_PANE_MENU = 501 Set A = .CreatePane(ID_PANE_MENU, 200, 120, DockLeftOf)
eg with the Control bars Public Const ID_FILE_OPEN = 101 Set Control = .Add(xtpControlButton, ID_FILE_OPEN, "&Open")
So, naturally when it came time to use the report control I assumed you would have the same theme and I put this code in my app to create some columns.
Public Const COLUMN_DATEISSUED = 101 Set Column = .Columns.Add(COLUMN_DATEISSUED, "Date Issued", 180, True)
This works fine and I can see that .Columns.Find would work the same as your other controls but I am having trouble finding and editing cell data and I cant see how our user defined IDs can help.
My problem occured when I tried to add data to the report. I used this code and nothing happened. Set Item = Record.AddItem("Test") Grid1.Populate
I eventually found out that you arent free to define your own IDs. You have to make your column identifiers sequential and 0 based. eg I had to change Public Const COLUMN_DATEISSUED = 101 to Public Const COLUMN_DATEISSUED = 0 and I could add data to my grid.
This brings me to my questions:
1. Why has this methodology changed? We could have our own unique identifiers before, but now we have to have them 0 based. This isnt really that big a problem but it is different from all the other controls you do so I am wondering why?
2. If the AddItem method uses the current column Index rather than our own defined ID's then how do we know what column you are adding into? or rather ammending? Do we have to loop across columns to get to the item we want to add / ammend? The sample app doesnt really show this as it just creates Items and adds them in sequentially. It doesnt really show how its position is kept track of. Wouldnt it have been clearer to do it like this.... Set Item = Record.AddItem("Test",COLUMN_DATEISSUED) ???
3. Could you provide an example to show how to change the value in a cell please.
Thanks
|