tôi tiếp tục nhận được lỗi này khi tôi cố gắng gọi Tìm()Lỗi: Phương pháp được chỉ định không được hỗ trợ?
public void findTxt(string text)
{
BindingSource src = new BindingSource();
src.DataSource = dataGridView1.DataSource;
src.Position = src.Find("p_Name", text); // Specified method is not supported
if (src.Position == 0 && dataGridView1.Rows[0].Cells[2].Value.ToString() == text)
{
MessageBox.Show("Item found!!");
dataGridView1.CurrentCell = dataGridView1.Rows[src.Position].Cells[2];
}
else if (src.Position == 0 && dataGridView1.Rows[0].Cells[2].Value.ToString() != text)
{
MessageBox.Show("Item not found!!");
}
else
{
MessageBox.Show("Item found!!");
dataGridView1.CurrentCell = dataGridView1.Rows[src.Position].Cells[2];
}
}
Edit:
tôi nhận lỗi rằng khi gọi phương pháp findText từ một hình thức khác, Tuy nhiên gọi phương pháp này từ hình thức chính doesn' t dẫn đến lỗi như vậy.
kết quả mong đợi của bạn là gì? – Anonymous
Xin lỗi nhưng tôi không hiểu câu hỏi của bạn. Vui lòng tham khảo bản chỉnh sửa của tôi. – DanSogaard