Barne,
I see a few things. Your first line in the loop messes with the listbox, when you change listItemID. See if this helps you understand the way it works better:
activate screen
for i = 1 to thisform.bwlst2.listCount
if (thisform.bwlst2.Selected(i))
? "Selected Item: ", thisform.bwlst2.List(i)
endif
next i
Also, it is usually better to refer to alias names, rather than hardcoded work areas. For example, when opening a table, and then later to close it:
use Table1 in 0
...... do some work ....
use in Table1
Finally, in order to alter table t1, you have to use it exclusively first. I don't see anything like the following in your code:
use t1 exclusive in 0
HTH
>List Box question: (beginning VFP7/OOP programmer)
>If you populate a list box programmatically, are the entries in the list box only active for a certain time? In the code below, I have two listboxes on a form. Objective is to interactively select fields in a table for deletion. The 1st listbox contains a list of tables one of which will be >
FOR m.licnt = 2 TO thisform.bwlst2.ListCount STEP 1
>
> &&debugging code
> thisform.bwlst2.ListItemId = m.licnt
> thisform.bwtxt1.Value = thisform.bwlst2.DisplayValue
> DO mbox &&message box pause
> thisform.bwtxt1.value = thisform.bwlst2.SelectedID(m.licnt)
> DO mbox
> && end of debugging code
>
> IF thisform.bwlst2.Selected(m.licnt) = .t.
> m.lcfldnm = thisform.bwlst2.DisplayValue
>
> &&debugging code
> thisform.bwtxt1.Value = m.lcfldnm
> DO mbox &&messagebox
> &&end debugging code
>
> ALTER TABLE t1 drop COLUMN (m.lcfldnm)
> ENDIF
>ENDFOR
>USE IN 1
>CLOSE DATABASES
>DO FORM deladdmodtbl
Steve Gibson