Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ComboBox- show list of suggested values
Message
De
13/01/2004 19:59:35
 
 
À
13/01/2004 19:43:27
Gerald Caussade
Department Mental Health - Missouri
Farmington, Missouri, États-Unis
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00863557
Message ID:
00866556
Vues:
45
Jerry,

>>I am now using some comboBoxes a bit differently. Instead of going to a database to look up a list of values to put in the list, I am putting them in the collection in the control.<

OK, how are you doing this? Adding to the Items collection? This should work, I think, but I've had problems with this in the past (possibly the old 1.0 version of the Framework, I don't remember) and so I got in the habit of just creating a quickie table to use as the DataSource. It doesn't even have to be a public table or anything, as once the Combo is filled, it doesn't care what happens to the DataSource. IOW, try something like this:
private void SetupMyCombo()
{
  DataTable dt = new DataTable();
  dt.Columns.Add("MyValueColumn");
  dt.Columns.Add("MyDisplayColumn");

  // etc. .... then fill the table with data

  MyCombo.DataSource = dt;
  MyCombo.DisplayMember = "MyDisplayColumn";
  MyCombo.ValueMember = "MyValueColumn;
}
>>I also have the Text field bound to the column/table that saves the data. This is giving me
problems.<


Are you talking about the .Text property of the Combo? I think I already told you that you don't want to Bind to that property. Always bind to the .SelectedValue, you'll save yourself a lot of headaches.
>>Also, I am occasionally seeing a concurrency exception when I move back and forth through the record set. Do you recognize this error and know what may be causing it?<

Dunno, fix the other problems first and maybe this one will go away. <g>

~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform