日期:2014-05-16 浏览次数:20934 次
private void btnGo_Click(object sender, EventArgs e)
{
foreach (string item in comboBox1.Items)
{
if (db.searchData(item))
{
if (item.StartsWith("Label"))
{
(this.panel1.Controls[item] as Label).Text = Convert.ToString(db.GetDbData(item));
}
else if (item.StartsWith("Meter"))
{
(this.panel1.Controls[item] as Meter).ChangeValue = Convert.ToDouble(db.GetDbData(item));
}
else if (item.StartsWith("Thermometer"))
{
(this.panel1.Controls[item] as Thermometer).CurValue = Convert.ToInt32(db.GetDbData(item));
}
else
{
MessageBox.Show("Form1 btnGo_Click there is no Controls");
}
}
}
}