How do I search data of a datagridview using a textbox and if it matches add its data to the second datagridview RRS feed

  • Question

  • I have a form with two datagridview the first one is to add items from csv or manually from textbox. What i want to do is i want to search for a item in the first gridview using the search button and the textbox and add quantity of that item and if the item matches the data from the first gridview it must add the item name , category,quantity and price of the item into the second gridview and calculate the total which is Price * Quantity how do i do this i just did a basic validation if the textbox's data is matching the gridview or not.

    for (int i = 0; i < dataGridView1.Rows.Count; i++)


                    for (int j = 0; j < dataGridView1.Columns.Count; j++)


                        if (dataGridView1.Rows[i].Cells[j].Value != null && 
                           searchTextBox.Text == 


                            MessageBox.Show("The value already existed in DataGridView.");
                            searchTextBox.Text = "";




    • Edited by MaddoxSt Saturday, January 6, 2018 4:57 AM
    Saturday, January 6, 2018 4:49 AM


  • I solved it already. This is the worst forum the shittiest forum i have been to!!!!

    • Marked as answer by MaddoxSt Saturday, January 6, 2018 3:03 PM
    Saturday, January 6, 2018 3:03 PM