Bonjour,
J'ai créé un formulaire avec un bindingSource. Lorsque je change une valeur d'un comboBox je souhaiterais que le BindingSource soit mis a jour.
Comment puis je faire?
merci pour votre aide
Bonjour,
J'ai créé un formulaire avec un bindingSource. Lorsque je change une valeur d'un comboBox je souhaiterais que le BindingSource soit mis a jour.
Comment puis je faire?
merci pour votre aide
Il faut lier le combobox avec le binding Source et lui dire sur quelle propriété il est lié.
Dans mon cas, j'ai une class Person avec une propriete Sexe ( pour H / F )
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13 // // comboBox1 // this.comboBox1.DataSource = this.bindingSource1; this.comboBox1.DisplayMember = "Sexe"; this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBox1.FormattingEnabled = true; this.comboBox1.Location = new System.Drawing.Point(12, 25); this.comboBox1.Name = "comboBox1"; this.comboBox1.Size = new System.Drawing.Size(121, 21); this.comboBox1.TabIndex = 0; this.comboBox1.ValueMember = "Sexe";
Partager