Bonjour
Je lie un Dictionnary à une Combobox.
Dans le SelectedValueChanged j'ai besoin de récupérer le KeyValuePair et je coince lamentablement.
Help me please !
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29 using System.Collections.Generic; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { Dictionary<string, string> t = new Dictionary<string, string>(); public Form1() { InitializeComponent(); t.Add("un", "lundi"); t.Add("deux", "mardi"); this.bindingSource1.DataSource = t; comboBox1.DataSource = this.bindingSource1; comboBox1.DisplayMember = "Key"; comboBox1.ValueMember = "Value"; } private void comboBox1_SelectedValueChanged(object sender, System.EventArgs e) { label1.Text = this.bindingSource1. Current ?????????????????????? } } }
Papy
Partager