private void gridView1_Click(object sender, EventArgs e) { int selectedHandle = this.gridView1.FocusedRowHandle;//获取焦点行索引 if (selectedHandle >= 0) { icbo_xm.SelectedIndex = -1; this.txt_cn.Text = "0"; this.txt_gz.Text = this.gridView1.GetRowCellValue(selectedHandle, "C_STL_GRD").ToString();// this.txt_dm.Text = this.gridView1.GetRowCellValue(selectedHandle, "C_SLAB_SIZE").ToString(); this.txt_dc.Text = this.gridView1.GetRowCellValue(selectedHandle, "N_LTH").ToString(); DataTable dt = bllwl.GetWL(this.txt_gz.Text, this.txt_dm.Text, this.txt_dc.Text); if (dt.Rows.Count > 0) { txt_dz.Text = dt.Rows[0]["N_HSL"].ToString();//单重 } else { txt_dz.Text = "1.5";//单重 } this.txt_jscn.Text = Math.Round(Convert.ToDecimal(this.txt_cn.Text) * Convert.ToDecimal(txt_dz.Text) / 12, 2).ToString(); } }