2 Replies - 1290 Views - Last Post: 21 May 2014 - 05:13 PM Rate Topic: -----

#1 Muneeba khan  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 12-April 14

remove selected item from list and add the removed items in combo box

Posted 02 May 2014 - 06:10 AM

//remove button code
Private Sub Command2_Click()
List2.RemoveItem List2.ListIndex
//this for add remove item  add to the combo box
Combo1.AddItem (List2.RemoveItem)

it remove the seected item but not add in the combo box
please help

This post has been edited by modi123_1: 02 May 2014 - 06:53 AM
Reason for edit:: use the code tag button in the editor

Is This A Good Question/Topic? 0
  • +

Replies To: remove selected item from list and add the removed items in combo box

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4333
  • View blog
  • Posts: 12,127
  • Joined: 18-April 07

Re: remove selected item from list and add the removed items in combo box

Posted 02 May 2014 - 02:41 PM

Try saving the value LOCATED AT List2.ListIndex first into a variable, remove the list item and when you go to add to the combo, use the variable.

:)

This post has been edited by Martyr2: 02 May 2014 - 02:42 PM

Was This Post Helpful? 0
  • +
  • -

#3 BobRodes  Icon User is offline

  • Your Friendly Local Curmudgeon
  • member icon

Reputation: 574
  • View blog
  • Posts: 2,989
  • Joined: 19-May 09

Re: remove selected item from list and add the removed items in combo box

Posted 21 May 2014 - 05:13 PM

RemoveItem is a method that removes an item from a list box. It doesn't after doing so become a property that contains the last removed item. You can do as Martyr2 suggests, or you can avoid creating a variable thus:

Combo1.AddItem List1.Text 'You could say List1.List(List1.ListIndex) if you wanted to get melodramatic
List1.RemoveItem List1.ListIndex


This post has been edited by BobRodes: 21 May 2014 - 05:14 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1