Hi ,
I have a problem filteting a datagrid that read his information from a txt file, the grid has this.
Pendiente Longitud Parametro Vertice
0 0 0 0
0,733333 120 20007,04 9365,221
6,73122 50 9292,37 9562,563
12,111977 62,627 1250 9661,794
-37,99 76,629 2100 9796,755
-1,5 58,4 1600 10164,71
-38 190 2500 10603,699
38 127,75 3500 10981,034
1,5 57,5 5000 11247,151
-10 192 4000 11784,128
38 127,75 3500 12152,33
1,5 301,486 8305,4 12489,698
37,8 72,6 2000 12982,12
1,5 67,5 15000 13232,408
6 96 4000 13455,722
30 57 2000 14328,915
1,5 0 0 0
This grid all rows, are DataGridViewCellStyle ,without format
i'm trying it load datagrid to a datatable, filter and upload again datatable to grid (not surre if it's the best way)
Private Sub Button3_Click_1(sender As Object, e As EventArgs) Handles Button3.Click
Dim dset As New DataSet
For i As Integer = 0 To DataGridView1.ColumnCount - 1
dset.Tables(0).Columns.Add(DataGridView1.Columns(i).HeaderText)
Next
Dim dr1 As DataRow
For i As Integer = 0 To DataGridView1.RowCount - 1
dr1 = dset.Tables(0).NewRow
For j As Integer = 0 To DataGridView1.Columns.Count - 1
dr1(j) = DataGridView1.Rows(i).Cells(j).Value
Next
dset.Tables(0).Rows.Add(dr1)
Next
Dim dv As New DataView
Dim filtro As String
dv = dset.Tables(0).DefaultView
filtro = "Longitud<" & "'" & TextBox1.Text.ToString & "'"
dv.RowFilter = filtro
DataGridView1.Rows.Clear()
DataGridView1.Columns.Clear()
DataGridView1.Refresh()
DataGridView1.DataSource = dv
end sub
textboxt1.text there is a 50 ,after click button 3 ,grid show me this
Pendiente Longitud Parametro Vertice
0,733333 120 20007,04 9365,221
-38 190 2500 10603,699
38 127,75 3500 10981,034
-10 192 4000 11784,128
38 127,75 3500 12152,33
1,5 301,486 8305,4 12489,698
1,5 0 0 0
Wha'ts wrong? ,the filter take some more than Longitud>50 and left some <50
I don't know how to fix it...
Thanks for all
I have a problem filteting a datagrid that read his information from a txt file, the grid has this.
Pendiente Longitud Parametro Vertice
0 0 0 0
0,733333 120 20007,04 9365,221
6,73122 50 9292,37 9562,563
12,111977 62,627 1250 9661,794
-37,99 76,629 2100 9796,755
-1,5 58,4 1600 10164,71
-38 190 2500 10603,699
38 127,75 3500 10981,034
1,5 57,5 5000 11247,151
-10 192 4000 11784,128
38 127,75 3500 12152,33
1,5 301,486 8305,4 12489,698
37,8 72,6 2000 12982,12
1,5 67,5 15000 13232,408
6 96 4000 13455,722
30 57 2000 14328,915
1,5 0 0 0
This grid all rows, are DataGridViewCellStyle ,without format
i'm trying it load datagrid to a datatable, filter and upload again datatable to grid (not surre if it's the best way)
Private Sub Button3_Click_1(sender As Object, e As EventArgs) Handles Button3.Click
Dim dset As New DataSet
For i As Integer = 0 To DataGridView1.ColumnCount - 1
dset.Tables(0).Columns.Add(DataGridView1.Columns(i).HeaderText)
Next
Dim dr1 As DataRow
For i As Integer = 0 To DataGridView1.RowCount - 1
dr1 = dset.Tables(0).NewRow
For j As Integer = 0 To DataGridView1.Columns.Count - 1
dr1(j) = DataGridView1.Rows(i).Cells(j).Value
Next
dset.Tables(0).Rows.Add(dr1)
Next
Dim dv As New DataView
Dim filtro As String
dv = dset.Tables(0).DefaultView
filtro = "Longitud<" & "'" & TextBox1.Text.ToString & "'"
dv.RowFilter = filtro
DataGridView1.Rows.Clear()
DataGridView1.Columns.Clear()
DataGridView1.Refresh()
DataGridView1.DataSource = dv
end sub
textboxt1.text there is a 50 ,after click button 3 ,grid show me this
Pendiente Longitud Parametro Vertice
0,733333 120 20007,04 9365,221
-38 190 2500 10603,699
38 127,75 3500 10981,034
-10 192 4000 11784,128
38 127,75 3500 12152,33
1,5 301,486 8305,4 12489,698
1,5 0 0 0
Wha'ts wrong? ,the filter take some more than Longitud>50 and left some <50
I don't know how to fix it...
Thanks for all