I keep getting this error when I try to call Find()
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:
I get that error when calling findText method from another form, However calling this method from the main form doesn't result in such an error.
It is up to the underlying data-source what operations it supports. I believe that DataTable
is the only one that out of the box supports this. You could check (in this case) via:
IBindingListView blv = yourDataSource as IBindingListView;
bool canSearch = blv != null && blv.SupportsSearching;
So; what is the underlying data source? A List<T>
(or even BindingList<T>
) won't provide this.
I had this error in my Asp.Net Core API. It was because of the the API difference in Asp.Net Framework and .Net Core. My application was in Asp.Net Framework and I had migrated it to the .Net Core. The below code will always work fine in the compile time, but this was failing at the run time and was throwing the error System.NotSupportedException: 'Specified method is not supported.'
Request.Body.Seek(0, SeekOrigin.Begin);
var streamReader = new StreamReader(Request.Body);
bodyData = await streamReader.ReadToEndAsync();
To fix this all you have to do is to change it in the right way as below.
bodyData = await new StreamReader(Request.Body, Encoding.Default).ReadToEndAsync();
You should also add System.Text
namespace.
Hope it helps.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With