Loading ...
Sorry, an error occurred while loading the content.
 

Empty Listbox Mystery

Expand Messages
  • TERENCE NUNN
    The code below trawls through a random access file, NOMACCS.DAT, and copies values into arrays, which are then used to populate a listbox. However, when I test
    Message 1 of 2 , Apr 2, 2012
      The code below trawls through a random access file, NOMACCS.DAT, and copies values into arrays, which are then used to populate a listbox. However, when I test run the program, suddenly the listbox has stopped displaying any data. I have not altered the code in any way (though I am still working on the program "lower down") and I have checked NOMACCS.DAT and it still contains the data.

      Another problem is that when I try to inspect NOMACCS.DAT via Liberty Basic, Liberty Basic seizes up, whereas there is no problem doing so via Windows Eplorer. Have I stumbled upon some kind of bug? Many thanks for any help, Terence Nunn.



      open "NOMACCS.DAT" for random as #1 len = 51 '---------------------get acc.list for listbox

      field #1, 30 as AccName$, 3 as AccNum$, 1 as AnyTrans, 1 as CanDel, 1 as CanRename, 8 as AccBal, 7 as SpareBytes$

      for N = 101 to 999
      get #1, N
      AccList$(N) = AccNum$
      if Trim$(AccName$) = "" then
      AccList$(N) = ""
      else
      AccList$(N) = AccList$(N) + " " + AccName$
      end if
      next N
      close #1

      'fill listbox

      print #nomnew.listbox11, "font courier_new 10"
      print #nomnew.listbox11, "reload" 'populate listbox-------------------
    • Rod
      Your code runs for me with few changes. I have created the data file and dimmed the array and opened the listbox window with the correct extensions. Anything
      Message 2 of 2 , Apr 2, 2012
        Your code runs for me with few changes. I have created the data file and dimmed the array and opened the listbox window with the correct extensions. Anything missing in your actual code? Watch for line wraps.

        open "NOMACCS.DAT" for random as #1 len = 51

        field #1, 30 as AccName$, 3 as AccNum$, 1 as AnyTrans, 1 as CanDel, 1 as CanRename, 8 as AccBal, 7 as SpareBytes$

        for N=101 to 999
        AccName$="Rod"
        AccNum$=str$(N)
        put #1,N
        next
        dim AccList$(1000)

        for N = 101 to 999
        get #1, N
        AccList$(N) = AccNum$
        if Trim$(AccName$) = "" then
        AccList$(N) = ""
        else
        AccList$(N) = AccList$(N) + " " + AccName$
        end if
        next N
        close #1

        'fill listbox
        WindowWidth = 600
        WindowHeight=400
        listbox #nomnew.listbox11,AccList$(, [selectitem], 10, 30, 200, 300

        open "List" for window as #nomnew
        #nomnew, "trapclose [quit]"
        #nomnew.listbox11, "font courier_new 10"
        #nomnew.listbox11, "reload" 'populate listbox-------------------
        wait

        [quit]
        close #nomnew
        end
      Your message has been successfully submitted and would be delivered to recipients shortly.