Why a can not use the .list statement..

User avatar
sal21
PlatinumLounger
Posts: 4481
Joined: 26 Apr 2010, 17:36

Why a can not use the .list statement..

Post by sal21 »

part of code

Code: Select all

...
strDBRows = RST0.GetRows
  RST0.Close

  Me.ORDINE.Clear
  Me.ORDINE.AddItem "TUTTI"
  
  'Me.ORDINE.List = strDBRows(1, I) & " - " & strDBRows(0, I)
  
  For I = 0 To UBound(strDBRows, 2)
    Me.ORDINE.AddItem Format(strDBRows(1, I), "#0000") & " - " & strDBRows(0, I)
    CONTA = CONTA + 1
  Next I
..
why instaed to loop with for next i cannot use the .list statement to fill the combobox.ORDINE in "one shot only"

Based :

User avatar
HansV
Administrator
Posts: 79365
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Why a can not use the .list statement..

Post by HansV »

strDBRows(1, I) and strDBRows(0, I) are single values, not arrays.
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4481
Joined: 26 Apr 2010, 17:36

Re: Why a can not use the .list statement..

Post by sal21 »

HansV wrote:strDBRows(1, I) and strDBRows(0, I) are single values, not arrays.
in my case how to fill the combobox.ORDINE in "one shot only" with strDBRows = RST0.GetRows???

note:
My query select, inother case 2 fileds and assign via getrow to strDBRows.

User avatar
HansV
Administrator
Posts: 79365
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Why a can not use the .list statement..

Post by HansV »

Is this in Excel or in VB6?
Best wishes,
Hans

User avatar
sal21
PlatinumLounger
Posts: 4481
Joined: 26 Apr 2010, 17:36

Re: Why a can not use the .list statement..

Post by sal21 »

HansV wrote:Is this in Excel or in VB6?
in VB6..

note:
Sorrym me on my stupid question and tks for your patience :sad: :grin:

User avatar
HansV
Administrator
Posts: 79365
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Why a can not use the .list statement..

Post by HansV »

I think you'll have to loop since the result of GetRows is an array with the columns in the first dimension and the rows in the second dimension.
The List property of a list box or combo box is an array with the rows in the first dimension and the columns in the second dimension.

Excel has a Transpose method, but VB6 hasn't...
Best wishes,
Hans

Becks
2StarLounger
Posts: 196
Joined: 31 Mar 2011, 03:41
Location: Perth, Western Australia

Re: Why a can not use the .list statement..

Post by Becks »

See http://support.microsoft.com/kb/246335 for a function to Transpose your dataset

Kevin