[RESOLVED] Trimming bound controls values
i have text- & comboboxes displaying char(255) data from SQL Server database.
if i input value with length 50 chars and press "Save", 205 blanc spaces are added (255 minus trimmed value's length) at the end.
how to enable text- and comboboxes to show trimmed values (w/out editing records)?
Re: Trimming bound controls values
...maybe datatable control has any property to make char values trimmed?
and is it possible to trim items of bound combobox manually?
Re: Trimming bound controls values
A bound control displays the data it is bound to, plain and simple. Perhaps you could add an extra column to your DataTable to contain the trimmed values which can be bound to the controls, then just transfer the values to the other column as needed.
Re: Trimming bound controls values
Re.: plain and simple:
yes, it is.
Re.:extra column:
i have already expression columns.
adding a new extra column per each text column would enlarge my project which is more than enough large :) (pls see my other threads - they are all related on the same project).
maybe i need to change data type of column in dataset or in MS SQL Server table ("string(255)" and "char(255)" now)?
i need 255 to be MAX length of a string, not FIXED one.
pls advise if you can.
Quote:
Originally Posted by jmcilhinney
A bound control displays the data it is bound to, plain and simple. Perhaps you could add an extra column to your DataTable to contain the trimmed values which can be bound to the controls, then just transfer the values to the other column as needed.
Re: Trimming bound controls values
is there any data type with limited but without fixed length?
Re: Trimming bound controls values
Re: Trimming bound controls values
Many thanks techgnome,
Pls advise if changing data type from char to varchar in MS SQL Server database causes error in my program?
do i need to reconfigure adapters (vs2005 beta2) and/or make any changement in bindingsources?
sorry, i can try but the project is TOO slow in design mode so advise if have time...
Quote:
Originally Posted by techgnome
varchar....
-tg
Re: Trimming bound controls values
thanks again to techgnome.
resolved.