日期:2014-05-17 浏览次数:21292 次
private void UPDATE_param_Load(object sender, EventArgs e)
{
DataSet ds = Param.Query_param();
count = ds.Tables["shape_param"].Rows.Count;
List<int> listid = new List<int>();
for (int i = 1; i <= count; i++)
{
DataRow dr = ds.Tables["shape_param"].Rows[i - 1];
list.Add(i, dr);
listid.Add(i);
}
//初始化下拉列表
listid.Add((count + 1));
Param.shape_type = shape_type;
comboBox_ID.DataSource = listid;
comboBox_ID.SelectedIndex = int.Parse(Param.GetID()) - 1;//不加这句话没有问题,但是没法显示对应的值。Param.GetID()返回的是字符串
}
private void comboBox_ID_SelectedIndexChanged(object sender, EventArgs e)
{
int id = int.Parse(comboBox_ID.SelectedItem.ToString());
if (id != count + 1)
{
DataRow dr = list[id];
txt_R1.Text = dr["R1"].ToString();
txt_R2.Text = dr["R2"].ToString();
txt_R3.Text = dr["R3"].ToString();
txt_R4.Text = dr["R4"].ToString();
txt_R5.Text = dr["R5"].ToString();
txt_D1.Text = dr["D1"].ToSt