Originally I wrote this question to the users mail list, but someone told me this is a mor appropriate forum.

I tried to copy a part of a column (one dimensional range...) to a combo box in a dialog I already created, so I wrote the following subroutine for it:

Sub addItemsComboBoxKund
        Dim Ctl As Object
        Dim Doc, Sheet, Range, Cursor As Object
        Dim Kunder As Variant

        Doc=StarDesktop.CurrentComponent
        Sheet=Doc.Sheets.getByName("Kunder")

        Range=Sheet.getCellRangeByPosition(1,1,1,13) ' B2:B14
        Cursor=Sheet.createCursorByRange(Range)
        Kunder=Cursor.getDataArray()

        Ctl=Dlg.getControl("ComboBoxKund")
        Ctl.addItems(Kunder,0)
End Sub

This failed and I got an error message at Ctl.addItems(Kunder,0). The reason for this seems to be that getDataArray handles two dimensions and addItems only one.

Of course I can copy the cells one by one in a loop from the two dimensional array, but that requires a loop, which I want to avoid because of speed. If there is a function doing the loop for me, it will probably be a lot faster, than if I write the loop myself.

So is there a way to get around this problem?

It would be nice if there was some kind of getDataArrayFromColumn method or something like that. Or maybe getColumnFromDataArray. Maybe there is no such thing, because who would ever need it except me..?


So is it really impossible to copy a part of a column directly to a combo box without a loop in the BASIC code?


Best regards
--
Johnny

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



Reply via email to