Hi,
I am working on a program that looks at a load of sql tables containing client information.
I have a databound table called FileDatagridview that contains all of the client information. Due to the nature of the work we do we have a lot of need to search, filter and select multiple client. I found that selecting clients using ctrl+click wasnt working because if a person then tried to filter to find the next client then the selection was lost. So I added an integer column called IsSelected to the sql table and shown it as a checkbox column on the FileDataGridView. This allows people to select and filter clients and then sort by selected or not.
How ever I need this column cleared before the table updates and saves otherwise the selections will pass to other users.
I've tried a number of ways and currently i have this. Pardon the poor coding but was just rough to see if it worked.
Code sorts the clients by IsSelected, then trys to change all the values from the bottom up to 0 as the sort puts all the "1" or Selected clients to the bottom.
This almost works except that the last selected appears as unselected how ever when i refilter or click off that client the selection shows up as still being there.
Can anyone think of a better way to clear this column or a better solution to the selection problem.
Thanks
I am working on a program that looks at a load of sql tables containing client information.
I have a databound table called FileDatagridview that contains all of the client information. Due to the nature of the work we do we have a lot of need to search, filter and select multiple client. I found that selecting clients using ctrl+click wasnt working because if a person then tried to filter to find the next client then the selection was lost. So I added an integer column called IsSelected to the sql table and shown it as a checkbox column on the FileDataGridView. This allows people to select and filter clients and then sort by selected or not.
How ever I need this column cleared before the table updates and saves otherwise the selections will pass to other users.
I've tried a number of ways and currently i have this. Pardon the poor coding but was just rough to see if it worked.
Code sorts the clients by IsSelected, then trys to change all the values from the bottom up to 0 as the sort puts all the "1" or Selected clients to the bottom.
VB.NET:
Me.FileBindingSource.Sort = "IsSelected"
Dim iR, tR As Integer
Dim rT As Integer = FileDataGridView.Rows.Count - 1
For iR = 0 To 99999
Try
If FileDataGridView.Rows(rT).Cells(5).Value = 1 Then
FileDataGridView.Rows(rT).Cells(5).Value = 0
FileDataGridView.CurrentCell = FileDataGridView.Rows(rT - 1).Cells(5)
Else
FileDataGridView.CurrentCell = FileDataGridView.Rows(rT - 1).Cells(5)
Exit For
End If
Catch
End Try
Next
This almost works except that the last selected appears as unselected how ever when i refilter or click off that client the selection shows up as still being there.
Can anyone think of a better way to clear this column or a better solution to the selection problem.
Thanks