Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Listbox


Message #1 by msayers@c... on Wed, 21 Nov 2001 15:23:26
Hi Folks,



  I am having a problem with removing items from a listbox.

I read a file and load the listbox.All well and cool, but I want the user 

to click on a name in the listbox, then be able to delete via 

automagically by clicking on a delete button or by the on_change event.

I am using a delete button because the on change doesn't always fire...

below is my code, no matter what I do, it always deletes the last name

Any help would be appreciated as I am a stumped chump...this should be easy

but it ain't working for me









Sub btnDelete_onclick()

    dim vcnts,xvalue,vindex



    vcnts = lstEmail.getCount()

    

    if vcnts <> 0 then

       

       xvalue = lstEmail.getValue()

       vindex = xvalue - 1

       lstEmail.selectByValue(xvalue)

       vname = lstEmail.getText()

       'xvalue = lstEmail.getValue(vname)

       lstEmail.removeItem(vindex)

    

    end if

End Sub

  Return to Index