Error: The specified method is not supported?

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 this error when calling the findText method from another form. However, calling this method from the main form does not result in such an error.

+8
source share
2 answers

Under the underlying data source it depends on what operations it supports. I believe that DataTableis the only one that supports this. You can check (in this case) with:

IBindingListView blv = yourDataSource as IBindingListView;
bool canSearch = blv != null && blv.SupportsSearching;

So what is the main data source? A List<T>(or even BindingList<T>) will not provide this.

+4
source

Asp.Net Core API. - API Asp.Net Framework .Net Core. Asp.Net Framework, .Net Core. , , System.NotSupportedException: 'Specified method is not supported.'

Request.Body.Seek(0, SeekOrigin.Begin);
var streamReader = new StreamReader(Request.Body);
bodyData = await streamReader.ReadToEndAsync();

enter image description here

, , , , .

bodyData = await new StreamReader(Request.Body, Encoding.Default).ReadToEndAsync();

System.Text.

, .

0

All Articles