Happy Easter to all!
I have a problem with a datagridview. I placed code in a button click event as follows:
When I run the program, I will be able to filter the datagridview by entering the lastname in the textbox then click the button. But, it only works twice. The third time I enter a new last name in the textbox and click the button, the program will freeze. I was expecting the code to work since I am assigning a new datatable for the datagridview everytime I click the button.
Any help will be very much appreciated. Thank you.
UPDATE 1:
I have traced the problem in the statement:
Does this mean that the way I am removing the datasource as...
is incorrect? If so, how should this be done? Thank you.
UPDATE 2:
Hi, I've tried declaring dtt like this but it didn't work...
I have a problem with a datagridview. I placed code in a button click event as follows:
Code:
dim dtt as datatable = dataset.employees.copy dtt.DefaultView.RowFilter = "[Last Name]='" & Me.LastNameTextBox.Text & "'" Me.DataGridView.DataSource = "" Me.DataGridView.DataSource = dtt
Any help will be very much appreciated. Thank you.
UPDATE 1:
I have traced the problem in the statement:
Code:
Me.DataGridView.DataSource = dtt
Code:
Me.DataGridView.DataSource = ""
UPDATE 2:
Hi, I've tried declaring dtt like this but it didn't work...
Code:
dim dtt as new datatable dtt = dataset.employees.copy
Comment