|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
numeric field bound to a textbox control, wrong formatWhy when the value of the field is 0, the textbox. text show as "0.0000" ???? When I tried to cast this to a integer variable there is an error: int j ; j= int.Parse(textbox.text) //Error which is correct because "0.0000" is not a numeric value. The same happens with a executescalar method whe the result is 0 ....... string mc= mycmd.executescalar().tostring(); ....... after this mc is "0.0000" !! TIA Fanor wrote:
Show quote > I have a textbox control bound to a integer field of a table. '*****************> Why when the value of the field is 0, the textbox. text show as "0.0000" > ???? > When I tried to cast this to a integer variable there is an error: > > int j ; > > j= int.Parse(textbox.text) //Error > > which is correct because "0.0000" is not a numeric value. > > The same happens with a executescalar method whe the result is 0 > > ...... > string mc= mycmd.executescalar().tostring(); > ...... > > after this mc is "0.0000" !! > > TIA int j ; j= Convert.ToInt32(textbox.text) Fanor wrote:
Show quote > I have a textbox control bound to a integer field of a table. '*****************> Why when the value of the field is 0, the textbox. text show as "0.0000" > ???? > When I tried to cast this to a integer variable there is an error: > > int j ; > > j= int.Parse(textbox.text) //Error > > which is correct because "0.0000" is not a numeric value. > > The same happens with a executescalar method whe the result is 0 > > ...... > string mc= mycmd.executescalar().tostring(); > ...... > > after this mc is "0.0000" !! > > TIA int j ; j= Convert.ToInt32(textbox.text)
Show quote
"Santosh" <saant***@gmail.com> wrote in message Doesn't work because textbox.text = "0.0000" which is not a valid number!!news:1151683866.281368.238450@h44g2000cwa.googlegroups.com... > > Fanor wrote: >> I have a textbox control bound to a integer field of a table. >> Why when the value of the field is 0, the textbox. text show as "0.0000" >> ???? >> When I tried to cast this to a integer variable there is an error: >> >> int j ; >> >> j= int.Parse(textbox.text) //Error >> >> which is correct because "0.0000" is not a numeric value. >> >> The same happens with a executescalar method whe the result is 0 >> >> ...... >> string mc= mycmd.executescalar().tostring(); >> ...... >> >> after this mc is "0.0000" !! >> >> TIA > > '***************** > int j ; > > j= Convert.ToInt32(textbox.text) furthermore the field value is 0, so textbox.text should be "0" not "0.0000" |
|||||||||||||||||||||||