TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Patrick Grindstaff
NA
6
0
Clearing a Combo Box while Preserving the Selected Index
Feb 13 2006 9:30 PM
I currently have a combo box filling with data from an Access Database. This data is stored in an ArrayList which happens to be repopulated after the SelectedIndex is changed in the combo box. My remedy to removing items that are not part of the index is clearing all of the items from the combo box list but the problem is, when the list is cleared, so is the current item selected. My goal is to clear the list but preserve the selected data each time i change the item in the list so that you can see the last name selected. Any help is appreciated. Here is some code to hopefully give you some idea of what I want to do. //Portion that fills combo box. employeeInformation.Clear(); employeeNamecomboBox.Items.Clear() //label1.Text = employeeInformation.Count.ToString(); foreach (DataRow dtRow in dTable.Rows) { employeeNamecomboBox.Items.Add(dtRow["FirstOfNAME"].ToString() + " " + dtRow["SOCIAL_SECURITY_NUMBER"].ToString()); employeeInformation.Add((string)dtRow["SOCIAL_SECURITY_NUMBER"].ToString()); employeeInformation.TrimToSize(); } //Queries database for selected info, clears image list. private void employeeNamecomboBox_SelectedIndexChanged(object sender, EventArgs e) { imagelistBox.Items.Clear(); ConnectToAccess(employeeInformation[employeeNamecomboBox.SelectedIndex].ToString()); } if more code is needed to make my situation more clear I will gladly post it. Thanks again
Reply
Answers (
1
)
How can I get a callback when a new process starts?
Generation of XML Signature using XPATH transform using c#