Reputation: 57
A filled datagridview control with a filter procedure with numbers as string. All word fine except do not show value = 100%
Column values: 62%, 71%, 75%, 80%, 88%, 92%, 100%
Code:
dv = New DataView(dTable, String.Format("L15 >= '{0}%'", TextBox1.Text), "", DataViewRowState.CurrentRows)
EX. If write 80 in TextBox show 80%, 88%, 92% but not 100%
Try with many convinations but nothing, What I missing?
Regards.
Upvotes: 0
Views: 139
Reputation: 54487
Don't populated the grid with Strings
. A DataGridView
is perfectly capable of storing non-text values and formatting them as text. What you should be doing is storing numbers in the DataTable
, binding it to a BindingSource
and binding that to the grid. You can set the DefaultCellStyle.Format
property of the grid column to format the numbers as percentages. If you store Double
or Decimal
values like 0.62 then "p0" would be the format specifier for percentages. You can then set the Filter
of the BindingSource
to filter in-place.
Upvotes: 1