List Box Problems

I am a bit of a begginer with this launguage so this question may sound really dumb.

I am loading a list box with data from the AS/400 which i am doing fine.  I have a menu option that i am creating to allow a user to change the way the data is viewed.  Bsically i am displaying Priority, Serial num etc  n the first view and in the second i want to display the view in Serial num, priority.  So when the 2nd view option is clicked i clear the list box, acess the data on the As/400 and add each record to the list box but this time adding serial number first + proprity etc.. all i get is a list load of "Falses".  When i debug the information i am adding to the list box seems fine, but when i do a quick watch for each record added, all that is displayed is a false.

I am no doubt doing somthing really dumb, so someone please HELP!!

Who is Participating?
tureConnect With a Mentor Commented:

The problem is that you have included an '=' in this line of code:

  LstPMWPC10.AddItem OrigRef + Space$(3) + Serial = Space$(3) + _
  Status + Space$(3) + SubStatus + Space$(3) + Description

Change it to:

  LstPMWPC10.AddItem OrigRef + Space$(3) + Serial + Space$(3) + _
  Status + Space$(3) + SubStatus + Space$(3) + Description

Ture Magnusson
Karlstad, Sweden
CRICEAuthor Commented:
Edited text of question.
Pls post a code snippet...
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

CRICEAuthor Commented:
Here's the code i am using when i click for the 2nd view!

Private Sub MnuViewOrgRef_Click()

    'Screen.MousePointer = vbHourglass   'Set mouse icon graphic
    LstPMWPC10.Clear           'Clear list bix
    Call Load_Listbox("Org")

Function Load_Listbox(ByVal ViewLst As String) 'Load list box from As/400 file PMPCHDRP

    sMessage = " "
    sRequest = sMessage

    'Test for the router and get a conv. id...
    'The AS/400 program name is passed as an argument...
    Call APPCInitialize("PMWPC10CTL.PROJECT2")
    'Send and receive data....
    Call SendReceive(sRequest, sResponse)
    sData = Left$(sResponse, 1000)      '   Add retrieved record
    sMessage = Right$(sResponse, 24)    '   strip out message

    'Display department descripiton
    TxtDeptID.Text = Mid$(sData, 1, 30)
   'extract record while message back from 400 is okay..
    Do While Trim$(sMessage) = "0" Or _
            Trim$(sMessage) = "1"
         'If no more records being transfered then leave loop
         If Trim$(sMessage) = "1" Then
            Exit Do
         End If
         'Format received data for display on list box
         PriorityInt = Mid$(sData, 31, 5)   'Isolate priority
         PriorityStr = PriorityInt          'Convert priority value to a string
         RSet PriorityR = PriorityStr       'Right set the string value
         Status = Mid$(sData, 36, 1)
         SubStatus = Mid$(sData, 37, 3)     'Isolate sub status
         Serial = Mid$(sData, 40, 8)        'Isolate serial refernece number
         Description = Mid$(sData, 48, 50)  'Isolate description
         OrigRef = Mid$(sData, 97, 10)      'isolate originators reference
         'Add item to list box which is keyed by priority
         If ViewLst = "Pty" Then
         LstPMWPC10.AddItem PriorityR + Space$(3) + Status + Space$(3) + SubStatus + _
         Space$(3) + Serial + Space$(3) + Description + Space$(3) + OrigRef
         End If
         If ViewLst = "Org" Then
         LstPMWPC10.AddItem OrigRef + Space$(3) + Serial = Space$(3) + _
                            Status + Space$(3) + SubStatus + Space$(3) + Description
         End If
         Call SendReceive(sRequest, sResponse)  'go again
         sData = Left$(sResponse, 1000)
         sMessage = Right$(sResponse, 24)   'strip out message
End Function
CRICEAuthor Commented:
Adjusted points to 200

Although this is not necessary, I recommend that you use '&' to concatenate strings, instead of '+', which should be used for mathematical addistions.

The line of code would look like this:

  LstPMWPC10.AddItem OrigRef & Space$(3) & Serial & Space$(3) & _
  Status & Space$(3) & SubStatus & Space$(3) & Description

CRICEAuthor Commented:
Ain't i the prize plonker!
Thanks, CRICE!

....and what is a prize plonker???

CRICEAuthor Commented:
Pize plonker = Idiot - which i am for not spotting such a stupid mistake.  Thanks for your advice on the & instead of + i shall use this as of now.
You may want to go through your source and check for rogue '=' signs matey!!!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.