Hello,
I have not used the listbox much and am having difficulty etracting the listed items. I must be making some obvious mistake but i haven't been able to spot it. The following code returns the same item for all ListBox selections. Here my code, can anyone spot my error? What am i doing wrong?
cnt = FF_ListBox_GetCount( HWND_FORMALLERGYCODES_LIST1 )
For a = 0 To cnt
sel = FF_ListBox_GetItemData (HWND_FORMALLERGYCODES_LIST1, a )
wk = FF_ListBox_GetText (HWND_FORMALLERGYCODES_LIST1, sel)
? "wk=" & wk
If Len(Trim$(wk)) > 3 Then
sVal = sVal & _
Trim$(Mid$(wk,1,8)) & "," & _
Trim$(Mid$(wk,9, 30)) & "," & _
Trim$(Mid$(wk,39, 6)) & ",~"
End If
Next
The wk value stays the same with each run thru the FOR/NEXT loop. It is always the first value of the ListBox. The code doesn't move to the next ListBox item. Any suggestions?
Change:
For a = 0 To cnt
sel = FF_ListBox_GetItemData (HWND_FORMALLERGYCODES_LIST1, a )
wk = FF_ListBox_GetText (HWND_FORMALLERGYCODES_LIST1, sel)
to:
For a = 0 To cnt - 1
wk = FF_ListBox_GetText (HWND_FORMALLERGYCODES_LIST1, a)
Jose, thank you.