G
Gian Paolo
hi all
i'm looking for a way to add 2 items in a combobox in the same line and
hide one.
i'm working on the code above but it returns me only the last value i
entered and i do not know why....
*********** CLASS
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;
}
}
}
************** FORM
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);
}
}
}
i'm looking for a way to add 2 items in a combobox in the same line and
hide one.
i'm working on the code above but it returns me only the last value i
entered and i do not know why....
*********** CLASS
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;
}
}
}
************** FORM
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);
}
}
}