using System; using System.Collections.Generic; using System.Text; namespace Interventi.Client { public class clscombo { public string Name; public int ReferenceID; public void Add(string name, int referenceID) { this.Name = name; this.ReferenceID = referenceID; } public override string ToString() { return this.Name; } } } using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; namespace Interventi.Client.Forms { public partial class frmComuni : Form { public frmComuni() { InitializeComponent(); } private void toolStripButton7_Click(object sender, EventArgs e) { this.Hide(); } private void frmComuni_Load(object sender, EventArgs e) { clscombo combo = new clscombo(); combo.Add("pippo", 3); cmbParametri.Items.Add(combo); combo.Add("prova", 6); cmbParametri.Items.Add(combo); cmbParametri.SelectedIndex = 0; } private void toolStripButton1_Click(object sender, EventArgs e) { } private void cmbParametri_SelectedIndexChanged(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { txtTesto.Text = String.Format("{0}", ((clscombo)cmbParametri.SelectedItem).ReferenceID); } } }