//快速查询
private void button2_Click(object sender, EventArgs e)
{
if (this.textBox2.Text == "")
{
MessageBox.Show("亲!没有数据!请先查询数据...");
}
else
{
for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
{
//hangshu =;/Rows列/Cells行。//如果找到货号
string itemNo = tbItemNo.Text.Trim().ToString();
string itemBarcode =tbItemBarcode.Text.Trim().ToString();
string itemHang = this.dataGridView1.Rows[i].Cells[0].Value.ToString().Trim();
string itemBarcodeHang = this.dataGridView1.Rows[i].Cells[1].Value.ToString().Trim();
if (itemNo == itemHang)
{
//string s = this.dataGridView1.Rows[i].Cells[5].Value.ToString().Trim();
this.dataGridView1.CurrentCell = this.dataGridView1[0, i];//定位到相同的单元格
//this.tbQty.Text = this.dataGridView1.Rows[i].Cells[5].Value.ToString().Trim();
//dataGridView1.DefaultCellStyle.BackColor = Color.Honeydew;//设置背景颜色
}
if (itemBarcode == itemBarcodeHang)
{
this.dataGridView1.CurrentCell = this.dataGridView1[1, i];//定位到相同的单元格
}
}
}
private void button2_Click(object sender, EventArgs e)
{
if (this.textBox2.Text == "")
{
MessageBox.Show("亲!没有数据!请先查询数据...");
}
else
{
for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
{
//hangshu =;/Rows列/Cells行。//如果找到货号
string itemNo = tbItemNo.Text.Trim().ToString();
string itemBarcode =tbItemBarcode.Text.Trim().ToString();
string itemHang = this.dataGridView1.Rows[i].Cells[0].Value.ToString().Trim();
string itemBarcodeHang = this.dataGridView1.Rows[i].Cells[1].Value.ToString().Trim();
if (itemNo == itemHang)
{
//string s = this.dataGridView1.Rows[i].Cells[5].Value.ToString().Trim();
this.dataGridView1.CurrentCell = this.dataGridView1[0, i];//定位到相同的单元格
//this.tbQty.Text = this.dataGridView1.Rows[i].Cells[5].Value.ToString().Trim();
//dataGridView1.DefaultCellStyle.BackColor = Color.Honeydew;//设置背景颜色
}
if (itemBarcode == itemBarcodeHang)
{
this.dataGridView1.CurrentCell = this.dataGridView1[1, i];//定位到相同的单元格
}
}
}