Andrew Douglas Pitonyak <[EMAIL PROTECTED]> skrev den Sat, 26 Mar 2005 10:45:51 -0500:

Johnny Andersson wrote:

The issue is that getDataArray() returns an array of arrays to handle
the two dimensions. So it looks more like:
Kunder=Array(array("a"), array("b"), array("c"))
which is why you get an error when using addItems.

So if the data were in a row you could do something like:
Ctl.addItems(Kunder(0),0)

If they are in a column then a loop to either create a one dimensional
array then addItems or addItem.

By the way you don't need to create a cursor. Range.getDataArray will
work.

Well, I will remember that. I guess that's what happens when learning from examples.


Do you know it there is a way to do this without using a loop or do I just have to give that idea up? The point in my case is, that those 13 rows in my example might grow a lot so speed is kind of relevant, especially since I am using a slow P2 450 MHz PC (which was very quick in early 1999.... ;D )

I think that you pretty much need to use a loop. GetDataArray is pretty fast, however...


Yes, I know, but I still can't understand what getDataArray returns!
I entered the following...

Sub addItemsComboBoxKund
        Dim Ctl As Object
        Dim Doc, Sheet, Cell, Range, Cursor As Object
        Dim AntalKunder, Varv As Integer
        Dim Kunder As Variant
        
        Doc=StarDesktop.CurrentComponent
        Sheet=Doc.Sheets.getByName("Kunder")
        Cell=Sheet.getCellByPosition(8,1)
        AntalKunder=Cell.Value

        Range=Sheet.getCellRangeByPosition(1,1,1,AntalKunder)
        Kunder=Range.getDataArray()

        Ctl=Dlg.getControl("ComboBoxKund")
'and so on...
End Sub

I defined a break point at "Ctl=Dlg.getControl("ComboBoxKund")" and then I checked some values in the Watch window.

I tried most things, like Kunder, Kunder (0), Kunder (0,0) but all of them were shown as <?>.

So HOW do I get something useful from getDataArray()?




--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to