473,320 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problem with Listbox - disables all the textboxes in the form

(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>
Nov 20 '05 #1
0 897

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Andy Weinmann | last post by:
I need to make a form through which I can edit the information for companies. I used a form in which the textboxes read from different columns from a listbox to display the information for a...
1
by: Geir Baardsen | last post by:
Hi! On frmItems I have a two listboxes. The first, lstAllCategories, is loaded with data from tblCategory when frmItems open. When user click lstAllCategories, the lstSelectedItems will show all...
1
by: bruce | last post by:
Hello, I have a small form that pops up when a user moves off the current record of a rather sizeable data entry form. The purpose of this form is to list warnings about various fields on the...
10
by: SueB | last post by:
Hi. Is there a way to "unselect" items in a listbox, programmatically? Here's what I want to do (and I've been trying to to this while debugging the form, but I've been unsuccessful) ... I...
2
by: mathieu cupryk | last post by:
I have problems with listboxes in the webform2.cs, the textboxes are working well when I do a click on next. I am missing something. It works with the textboxes. Here is the file: using System;...
10
by: yop | last post by:
All When I try to get the text from my listbox I am get an error which is listed below. Any ideas? Thanks Object reference not set to an instance of an object.
4
by: Amy Snyder | last post by:
I have a webform that has a listbox and two textboxes. The style property of the text boxes are: style="DISPLAY: none" Based on the selection made in the listbox, one or both textboxes are...
5
by: John Cosmas | last post by:
I have a form that has a listbox on the top that is bound to a header table. When the page first loads, it paints the adjacent textboxes with data from the details table. However, when I postback...
7
by: onyris | last post by:
Hi guys, have a form which displays all the records i have in my database , and a search box for the user to search for a specific one . On the search button, i run a macro which opens another...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.