Code broken when moving from VS 2002 to VS 2003

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Segfahlt

    Code broken when moving from VS 2002 to VS 2003

    I have an inherited comboBox that I'm using to try to make an intellisense type box in VS 2003 .Net.

    It works okay when compiled in VS.Net 2002. It doesn't work when compiled in VS.Net 2003. In 2003, it compiles fine with no error or warnings, but doesn't do what its supposed to. I've done some
    tweaking here and there, and nothing I do seems to work. Anybody got any ideas on this?

    the difference between 2002 and 2003 is that the value typed into the combobox is not getting updated in the OnKeyPress method. So the combobox.Text is still set to what was in it PRIOR to the
    OnKeyPress method getting called.

    Here is a snippet of my code. The Application.DoE vents() funcs are just so I can see what's going on at various spots.

    private void OnKeyPress(obje ct sender, System.Windows. Forms.KeyPressE ventArgs e) {
    string _cmbText;
    int selectionStart;
    int selectionLength ;
    AutoComboBox _cmb = (AutoComboBox) sender;

    if (_cmb.DropDownS tyle == System.Windows. Forms.ComboBoxS tyle.DropDown ||
    _cmb.DropDownSt yle == System.Windows. Forms.ComboBoxS tyle.Simple) {

    _cmbText = SearchList(_cmb ); //this returns the Text at the index of the combobox from the FindText(string ) func
    if (_cmbText != String.Empty) {

    selectionStart = _cmb.Text.Lengt h;
    selectionLength = _cmbText.Length - _cmb.Text.Lengt h;

    _cmb.SelectedIn dex = _cmb.FindString (_cmbText);

    _cmb.SelectionS tart = selectionStart;
    _cmb.SelectionL ength = selectionLength ;

    e.Handled = true;
    }
    }
    }


Working...