P
powerranger
The code below gets data from my webservice and load the data into the
array called myarray using a class called DataClass. I would like to
use the same process (LoaData) to bind differrent comboboxes by using
different classes. How can I modify the LoadData so that I can pass in
the class -- private void LoadData(System.Windows.Forms.ComboBox cmbo,
??). Any sample of code would be very helpfull. Thanks.
private void LoadData(System.Windows.Forms.ComboBox cmbo)
{
WebService.GetData mydata = new WS.GetData();
DataSet Ds = mydata.GetInfo();
foreach (DataRow Dr in Ds.Tables["StateList"].Rows)
{
MyArray.Add(new DataClass(Convert.ToInt32(Dr["ID"].ToString()),
Dr["Desc"].ToString()));
}
cmbo.DisplayMember = "Desc";
cmbo.ValueMember = "Id";
cmbo.DataSource = MyArray;
array called myarray using a class called DataClass. I would like to
use the same process (LoaData) to bind differrent comboboxes by using
different classes. How can I modify the LoadData so that I can pass in
the class -- private void LoadData(System.Windows.Forms.ComboBox cmbo,
??). Any sample of code would be very helpfull. Thanks.
private void LoadData(System.Windows.Forms.ComboBox cmbo)
{
WebService.GetData mydata = new WS.GetData();
DataSet Ds = mydata.GetInfo();
foreach (DataRow Dr in Ds.Tables["StateList"].Rows)
{
MyArray.Add(new DataClass(Convert.ToInt32(Dr["ID"].ToString()),
Dr["Desc"].ToString()));
}
cmbo.DisplayMember = "Desc";
cmbo.ValueMember = "Id";
cmbo.DataSource = MyArray;