(Type your message here)
--------------------------------
From: RS -
Hi,
I am trying to copy the items from one listbox to anotherlistbox. Both the list boxes are with multiple selection mode.The firstlistbox is populated from a databse.My code copiesselected items without any problem but it disables all thetextbox and doesn't give any error. Interestingly the other formelement like checkbox and button remain enabled. I debugged theproblem but couldn't figure out why its happening.There is nocode in the whole application to disable the textboxes.
Your help is badly needed.
This is the code I am using as shown below. Please look into thecode and let me know if there is something I am missing.
Sub AddRemoveKeywords(Sender as object,e as eventArgs)
dim keywordItem as listItem
dim selectedKeyword
dim itemInFirstBox as new ListItem
dim itemInSecondBox as new ListItem
dim x as listItem
dim blnExist as boolean
try
if sender.id ="BtnAddKeywords" then
blnExist = false
For Each itemInFirstBox in ddl_keywords.items
IF itemInFirstBox.selected = true then
'Check if the item already exist in selected list
FOR EACH itemInSecondBox in ddl_selectedKeywords.items
IF itemInFirstBox.value = itemInSecondBox.value THEN
blnExist = true
Exit For
ELSE
blnExist = false
END IF
NEXT
IF Not blnExist Then
keywordItem = new listItem()
keywordItem.text = itemInFirstBox.text
keywordItem.value = itemInFirstBox.value
ddl_selectedKeywords.items.add(keywordItem)
End IF
END IF
NEXT
elseif sender.id = "BtnRemoveKeywords" then
keywordItem = new listItem()
keywordItem.text = ddl_selectedKeywords.selectedItem.text
ddl_selectedKeywords.items.remove(keywordItem)
end if
catch ee as NullReferenceException
trace.write(ee.message.toString(),"Error")
finally
end try
End Sub
Thanks,
-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)
<Id>gL0QbMnGZEaOh9Gqa6Nn+g==</Id>