2

Good day, newbie here asking for help.

I've been creating a comparison chart by using Visual Studio 2012 and C#.

The function required is to able to compare two megabytes size csv-based source files, display information within in table form which I'd make use of two datagridview, namely datagridview1 and datagridview2.

As the tool is dealing with time-related source, the user request had been updated to include the capability to re-select first row from both tables, in order to re-align the first signals captured which might, and most of the time, occurred on different time.

Test code 1

    private void realigndataGridView1_MouseDown(object sender, MouseEventArgs e)
    {
        int count = 0;

        if (dataGridView1.Rows.Count > 1)
        {
            if (dataGridView1.Rows[dataGridView1.CurrentRow.Index].IsNewRow != true)
            {
                do
                {
                    dataGridView1.Rows.Remove(dataGridView1.Rows[count]);
                    count ++;
                } while (dataGridView1.Rows[count].Index < dataGridView1.Rows[dataGridView1.CurrentRow.Index].Index);
            }
        }
    }     

Test code 2

    private void btnDelete_Click(object sender, EventArgs e)
    {
        delete_DGV1_selectedrows();
        delete_DGV2_selectedrows();

    }

    private void delete_DGV1_selectedrows()
    {
        List<DataGridViewRow> selectedRows = new List<DataGridViewRow>();

        foreach (DataGridViewRow row_i1 in dataGridView1.SelectedRows)
            selectedRows.Add(row_i1);

        //now delete rows:
        foreach (DataGridViewRow row_i1 in selectedRows)
            dataGridView1.Rows.Remove(row_i1);
    }

    private void delete_DGV2_selectedrows()
    {
        List<DataGridViewRow> selectedRows = new List<DataGridViewRow>();

        foreach (DataGridViewRow row_i2 in dataGridView2.SelectedRows)
            selectedRows.Add(row_i2);

        foreach (DataGridViewRow row_i2 in selectedRows)
            dataGridView2.Rows.Remove(row_i2);
    }

I'd tried to utilize the idea to delete previous rows before selected row, as shown above. But to avoid deleting useful rows accidentally, an undo function is currently under development.

//=======================================================================//

I need some advice on changing the displays solely on datagridview charts but the modification shall not involved the BindingSource.datasource(s) engaged with.

I took Beyond Compare as benchmark but it's very hard for me to create such feature now.

0 Answers0