RichDu
asked on
c# combobox autocomplete behavior
Hi guys and girls,
I wrote an apps in c# and just found out that for some computer who need to stay in XP for compatibility reason (old soft), i have a different autocomplete behavior with combobox.
wrote 351 and all my list starting with 351 appear like this
- What i want (and work perfectly on win7 and above)
351
351-A
3510
351C
- What i got with XP (SP3)
wrote 351 but as soon as i get the 1 i got this
351
Everyting in my list witch is not exacly 351 is not visible.
My combobox is autocompletemode = Suggest and autocompletesource = listitems. I also tried SuggestAppend and nothing change. If anyone have a clue i would appreciate !
Thank you
I wrote an apps in c# and just found out that for some computer who need to stay in XP for compatibility reason (old soft), i have a different autocomplete behavior with combobox.
wrote 351 and all my list starting with 351 appear like this
- What i want (and work perfectly on win7 and above)
351
351-A
3510
351C
- What i got with XP (SP3)
wrote 351 but as soon as i get the 1 i got this
351
Everyting in my list witch is not exacly 351 is not visible.
My combobox is autocompletemode = Suggest and autocompletesource = listitems. I also tried SuggestAppend and nothing change. If anyone have a clue i would appreciate !
Thank you
ASKER
Hi it_saige,
I would like to but i dont know which code i can provide. The combobox is filled by a SQL resquest. The setting of my combobox is ajusted with the properties tab.
If i press manually to access the list, everything is there in both OS. If i wrote in the combobox, than a list is made with the Suggest setting. The only difference is the fact that the list is not complete with XP as is it with win7.
If there's more info i can provide please dont hesitate !
Thank you
I would like to but i dont know which code i can provide. The combobox is filled by a SQL resquest. The setting of my combobox is ajusted with the properties tab.
If i press manually to access the list, everything is there in both OS. If i wrote in the combobox, than a list is made with the Suggest setting. The only difference is the fact that the list is not complete with XP as is it with win7.
If there's more info i can provide please dont hesitate !
Thank you
Let's start with how you fill your combobox. You said it is filled by a SQL request. Do you fill it directly from a datareader; e.g. -
This code would be important. Also you mention settings adjusted by properties. What are the settings you adjust and then verify that you do not make any changes to the properties of the control within other methods of your form, if you do, include those changes.
-saige-
while (reader.Read())
{
combobox1.Items.Add(reader["SomeFieldName"].ToString());
}
Do you fill a list and set the list as a datasource for the combobox; e.g. -
List<SomeObject> objects = new List<SomeObject>()
while (reader.Read())
{
objects.Add(new SomeObject() { SomeFieldName = reader["SomeFieldName"].ToString() });
}
combobox1.DataSource = objects;
This code would be important. Also you mention settings adjusted by properties. What are the settings you adjust and then verify that you do not make any changes to the properties of the control within other methods of your form, if you do, include those changes.
-saige-
ASKER
there it is
The only oyher setting i've change is FormattingEnabled = true. All others setting ar by default.
Thank you !
try
{
SqlConnection read = Cts.Login.ConnectRead();
SqlCommand mycom = read.CreateCommand();
mycom.CommandText = "SELECT Selection " +
"FROM ItemsQuinc ORDER BY Selection ASC";
SqlDataAdapter da = new SqlDataAdapter(mycom);
DataSet dataSet = new DataSet();
da.Fill(dataSet);
itemComboBox.DataSource = dataSet.Tables[0];
itemComboBox.DisplayMember = "Selection";
read.Close();
read.Dispose();
}
catch (SqlException ex)
{
System.Windows.Forms.MessageBox.Show(ex.Message);
return;
}
The only oyher setting i've change is FormattingEnabled = true. All others setting ar by default.
Thank you !
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi saige,
It works perfectly !!!
i will have to understand why the properties setting wont work but the way you make it work well.
Thanks again for your time :)
It works perfectly !!!
i will have to understand why the properties setting wont work but the way you make it work well.
Thanks again for your time :)
-saige-