hi everyone,
I have a problem with manually inserting element into my listbox. There is the code I'm using:
ListBox2.Items.Insert(0, ListBox1.SelectedItem)
or
Dim
myItem = New ListItemmyItem.value =
"wisconsin"myItem.text =
"Wisconsin" ListBox1.Items.Add(myItem)I've also tried using the add method but either way I do it it still insert the element twice in the listbox. Now I dont know if there is something I'm doing wrong or is that a bug.
I'm using visual dev express 05 on windows xp pro.
thk you.

urgent !!!!listbox inserting problem
Chris R Jones
mjn
If your code is only called once, and the item is being inserted twice, then it was already in there to start with, or other code is doing the insert. There is no bug where calling insert once causes an item to be inserted twice.
TheViewMaster
Have you put a breakpoint in the code I'd be willing to bet that the problem is that your code is being called twice, probably as some event fires.
Canderson
Perhaps you need to post the code, so we can see what you're doing Is the insert happening in response to a click event
David_Wilson
The way I did it is that in the button tag I had a onCLick that I replace by a onClientClick and its stopped firing twice but I still dont understand what is the difference and why the first method made it fire twice.
And I'm gonna ask another question , does anyone know how to get the element from a listbox but not the selected one, any element without the element beeing selected
Thank you Christian you put me in the path for that solution.
wramos
hi,
Is your problem solved
Thank you,
Bhanu.
Nate
Ronald S.
I've tried the breakpoint and unfortunately I have the same result.
Do you think it could be something else beside the loop.
Art Gardner
Dim myItem = New ListItemmyItem.value =
"wisconsin"myItem.text =
"Wisconsin"ListBox1.Items.Add(myItem)
'If (fn <> "" And ln <> "") Then 'search_fn_ln(fn, ln) 'Label1.Text = "fn and ln full" 'ElseIf (ln <> "") Then 'Label1.Text = "ln only full" 'ElseIf (fn <> "") Then 'Label1.Text = "fn only full" 'Else 'Label1.Text = "None full" 'End If End Subthere is the code, its suppose to add wisconsin when the user click on a button.
WorkTimer
My first guess is still that the event is being attached to the button twice, and so firing twice. Beyond that, I can't imagine what could cause it. But then your breakpoint would fire twice.
meade