 |
|
 |
Hello, a newbie query - I have used the code in LookupComboBox.cs to create a new component in VS 2005. This works well, but after a short time the component becomes invisible in the designer (and executable) although it still exists. What am I doing wrong ?
thanks
Chris Divine
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
 |
When you have Databinding, you assume a DataRowView is bound. Actually I bound a normal Object on it, and the cast to DataRowView will cause a exception.
You should check in the if-clause where databinding is checked, if the bound item actually IS a DataRowView before casting it:
// If data are bound to combo-box if ((this.DataSource != null && this.DisplayMember != "") && (this.Items[index] is DataRowView)) { found = ((DataRowView)(this.Items[index]))[this.DisplayMember].ToString(); } else { found = this.Items[index].ToString(); }
-- Do you have the right problem for my solutions?
|
| Sign In·View Thread·PermaLink | 1.00/5 |
|
|
|
 |
|
 |
Add an item "IteM 2.1" Type in "Item 2.1" Then delete the ".1" You are now left with "IteM 2" which is not in the list.
Chris
|
| Sign In·View Thread·PermaLink | |
|
|
|
 |
|
|
 |
|
|
 |
|
 |
Hi
I've just been testing the look-up combo-box control of yours in C#, thinking it would make a good replacement for the standard Windows.Forms ComboBox.
I can't seem to get the 'SelectedIndexChanged' property working though, when I enact it in relation to the look-up combo box (The code ran fine under the standard Windows ComboBox).
I'd appreciate it if you could take a look at this for me. Here's the header I'm using: (I renamed the control cboServerTypes as this is what the old combobox was).
private void cboServerTypes_SelectedIndexChanged(object sender, EventArgs e)
Thanks very much,
Ben
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
|
 |
For some reason, calling myLookupCombobox.Focus() generates a KeyUp event. This causes a problem because there was no true key press, and the "actual" string is blank. This forces the lookupCombobox to change to the first entry in the list, no matter what was previously selected. I fixed it by adding a check for a blank "actual" string just below the control keys section and returning if the "actual" string is blank.
Just thought you might like to know.
|
| Sign In·View Thread·PermaLink | 2.00/5 |
|
|
|
 |
 | Bug  Josef Meile | 1:10 2 May '05 |
|
 |
Hi,
I found a bug when returning to the field with the Shift+Tab key combination. Steps to reproduce the bug:
1) Open the example application: "ExampleLookupComboBox.exe" 2) Click on the look-up comboBox to give it the focus. 3) Type "i" -> Now "Item 1" should be selected 4) Press the "Tab" key -> It will give the focus to the comboBoxAllowTypeAllSymbolsValue 5) Press Shift+Tab -> The focus gets back to the look-up comboBox 6) Press Alt+Down Arrow -> The pull down list will be shown 7) Scroll with the Down Arrow and choose other value 8) Press Tab -> the look-up comboBox will loose the focus 9) Press Shift+Tab -> the look-up comboBox will get the focus and the selected value will be restored to "Item 1", which isn't the expected behaviour. Instead, it must keep the value you choose on step 7 as it happens with the standard ComboBox control.
Regards, Josef
|
| Sign In·View Thread·PermaLink | 5.00/5 |
|
|
|
 |
|
 |
Ok, I found the error:
You have also have to add the Tab and Alt keys to the ignored keys on your OnKeyUp handler:
if ((e.KeyCode == Keys.Back) || (e.KeyCode == Keys.Left) || (e.KeyCode == Keys.Right) || (e.KeyCode == Keys.Up) || (e.KeyCode == Keys.Down) || (e.KeyCode == Keys.Delete) || (e.KeyCode == Keys.PageUp) || (e.KeyCode == Keys.PageDown) || (e.KeyCode == Keys.Home) || (e.KeyCode == Keys.End) || (e.KeyCode == Keys.ShiftKey) || (e.KeyCode == Keys.Tab) || (e.KeyCode == Keys.Menu)) { return; }
Note that instead of Keys.Alt, I included Keys.Menu. When you release the Alt key, you will get KeyCode = 18 and not KeyCode = 262144 as Keys.Alt suggests.
Regards, Josef
|
| Sign In·View Thread·PermaLink | 5.00/5 |
|
|
|
 |
|
 |
Josef, thank you very much. I will apply your suggestions to source code and update article's download.
dotNet Toys
|
| Sign In·View Thread·PermaLink | 4.20/5 |
|
|
|
 |