Home All Groups Group Topic Archive Search About

numeric field bound to a textbox control, wrong format

Author
30 Jun 2006 3:02 PM
Fanor
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

Author
30 Jun 2006 4:08 PM
Santosh
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)
Author
30 Jun 2006 4:11 PM
Santosh
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)
Author
30 Jun 2006 5:38 PM
Fanor
Show quote
"Santosh" <saant***@gmail.com> wrote in message
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)



Doesn't work because textbox.text  = "0.0000"  which is not a valid number!!
furthermore the field value is  0, so textbox.text should be  "0"  not
"0.0000"

AddThis Social Bookmark Button