realbasic-nug
[Top] [All Lists]

Re: Dictionary Value count

To: RBNUG <realbasic-nug at lists dot realsoftware dot com>
Subject: Re: Dictionary Value count
From: Seth Duke <seth at johnfinley dot com>
Date: Tue, 31 May 2005 11:31:01 -0400
Delivered-to: realbasic-nug at lists dot realsoftware dot com
On 5/31/05 9:47 AM, "tom dot russell at transport dot alstom dot com"
<tom dot russell at transport dot alstom dot com> wrote:

> Ok got that. But if I do this I get an outofbounds:
> 
>   for i = 0 to listbox1.listCount - 1
>     prefsDict.value("runs_"+str(i)+"_0") = listbox1.cell(i,0)
>     prefsDict.value("runs_"+str(i)+"_1") = listbox1.cell(i,1)
>     prefsDict.value("runs_"+str(i)+"_2") = listbox1.cell(i,2)
>     prefsDict.value("runs_"+str(i)+"_3") = listbox1.cell(i,3)
>   next

I did a quick test and it works just fine for me.

  Dim i, n As Integer
  Dim mydict as new Dictionary
  
  n = ListBox1.ListCount-1
  for i = 0 to n
    mydict.Value("runs_"+str(i)+"_0") = ListBox1.Cell(i, 0)
    mydict.Value("runs_"+str(i)+"_1") = ListBox1.Cell(i, 1)
    mydict.Value("runs_"+str(i)+"_2") = ListBox1.Cell(i, 2)
    mydict.Value("runs_"+str(i)+"_3") = ListBox1.Cell(i, 3)
  next
  
  'ListBox1 has the values:
  ' 1 2 3 4
  ' 5 6 7 8
  ' 9 10 11 12
  ' 13 14 15 16

-Seth


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>