I being starting to switch to C# from VB.Net.
And to be honest my knowledge from using C is pretty outdated since i used that last years ago.
So i am still figuring things back out.
I wont be surprised if this ends up being a simple fix.

The program goes into runtime, but upon clicking one of the cells in my datagrid i can see the data change in the textboxes.
But it then throws an error.

SyntaxErrorException was unhandled
An unhandled exception of type 'System.Data.SyntaxErrorException' occurred in System.Data.dll
Additional information: Syntax error: Missing operand after ''2'' operator.

        private void FamBestandDataGridView_CellClick(object sender, DataGridViewCellEventArgs e)
            BindingSource source1 = new BindingSource();
            source1.DataSource = fBDataSet.FamBestand;

            FamilieDossierDataGridView.DataSource = source1;

            source1.Filter = "FamilieNummer'" + famBestandDataGridView.Rows[e.RowIndex].Cells[3].Value.ToString() + "' ";
            naamTextBox.Text = famBestandDataGridView.Rows[e.RowIndex].Cells[1].Value.ToString();
            voornaamTextBox.Text = famBestandDataGridView.Rows[e.RowIndex].Cells[2].Value.ToString();
            familieNummerTextBox.Text = famBestandDataGridView.Rows[e.RowIndex].Cells[3].Value.ToString();
            archiefKastTextBox.Text = famBestandDataGridView.Rows[e.RowIndex].Cells[4].Value.ToString();
            notaTextBox.Text = famBestandDataGridView.Rows[e.RowIndex].Cells[5].Value.ToString();
            opmerkingTextBox.Text = famBestandDataGridView.Rows[e.RowIndex].Cells[6].Value.ToString();



Don't know what your intensions are with source1, but it will be lost after FamBestandDataGridView_CellClick finishes on line 16.

if there are 5 column you should have an index 0-4
if six 0-5

Edited 2 Years Ago by Cronomax

This article has been dead for over six months. Start a new discussion instead.