我有两个TextBox;
但是当我搜索FIrmBAsed
信息时,我会在DataGridView1
DataTAble1
FirmName
中获取Prpoer Reslut但是当我正在取消CUstome Name
内容时,我会搜索DATABLE1
我从DataGridView1
获取了行但是无法在private void txtCustomerName_TextChanged(object sender, EventArgs e)
{
if (txtCustomerName.Text == "")
{
dgvSearchData.Visible = false;
}
else
{
dgvSearchData.Visible = true;
dgvSearchData.Location = new Point(txtCustomerName.Location.X, (txtCustomerName.Location.Y + txtCustomerName.Height));
query = "Select CustomerName,FirmName, Address, City from CustomerMaster WHERE CustomerName LIKE '" + txtCustomerName.Text + "%' ";
dtCustomer.Clear();
dtCustomer = objDBConnection.fSelect(query);
**dgvSearchData.DataSource = dtCustomer;**
if (dgvSearchData.Rows.Count > 0) dgvSearchData.Rows[0].Selected = false;
if (dgvSearchData.Rows.Count == 1) dgvSearchData.Rows[0].Selected = true;
if (dgvSearchData.Rows.Count > 0)
dgvSearchData.Height = (dgvSearchData.Rows.Count) * 23;
if (dgvSearchData.Height >= new frmRetailBill().Size.Height)
dgvSearchData.Height = new frmRetailBill().Size.Height - 20;
for (int i = 1; i < dgvSearchData.Columns.Count; i++)
dgvSearchData.Columns[i].Visible = false;
}
}
public void fillCusotmerData()
{
for (int i = 1; i < dgvSearchData.Columns.Count; i++)
dgvSearchData.Columns[i].Visible = true;
txtCustomerName.Text = dgvSearchData.SelectedRows[0].Cells["CustomerName"].Value.ToString();
txtFirmName.Text = dgvSearchData.SelectedRows[0].Cells["FirmName"].Value.ToString();
txtAddress.Text = dgvSearchData.SelectedRows[0].Cells["Address"].Value.ToString() + " " + dgvSearchData.SelectedRows[0].Cells["City"].Value.ToString();
dgvSearchData.Visible = false;
txtPartNumber.Focus();
}
中显示...而是看不到......我可能知道原因......
代码:
{{1}}