|
-
Jan 28th, 2009, 09:00 AM
#1
Thread Starter
Addicted Member
[2008] Combo problem
Hello all,
I have a bound DataGridView, displaying some columns relevant to the user, which I use to scroll up and down to display more detailed data in another area of the form relating to the row selected in the DataGridView. This works ok, except for a ComboBox on the form.
The Combo can be populated, or not, depending on what the user wants to do with it. At the moment, the Combo can display either of two items, "ERROR" or "ADJUST" - though this will be added to at a later stage.
What I'm finding is that if one record is set to "ERROR", when I scroll up/down in the DataGridView, every record relating to the selected row displays "ERROR" - even if the record shouldn't have anything in the Combo.
If I update a different record, and make the contents of the Combo "ADJUST", "ADJUST" is displayed on each record until it encounters an "ERROR", at which point any record which shouldn't have anything in the Combo displays "ERROR". If I scroll back through an "ADJUST", everything which shouldn't have anything in the Combo displays "ADJUST".
What am I doing wrong?
-
Jan 28th, 2009, 09:06 AM
#2
Re: [2008] Combo problem
When you move off the selected record set the Combobox Selected item to -1 and the selected text to string.Empty
Sometimes the Programmer
Sometimes the DBA
Mazz1
-
Jan 28th, 2009, 09:21 PM
#3
Re: [2008] Combo problem
 Originally Posted by GaryMazzone
When you move off the selected record set the Combobox Selected item to -1 and the selected text to string.Empty
You would set the SelectedItem to Nothing or the SelectedIndex to -1.
The SelectedText is not relevant in this case. It behaves just like the SelectedText property of a TextBox and is not related to the items in the drop-down list at all. It's only relevant if the DropDownStyle is DropDown and event then not for a situation like this.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|