razza_b
asked on
format a textbox to remove .000
Hi
I have a textbox that gets assigned qty values but it appears as e.g. 126.000 and would like it to be 126.
any ideas?
Thanks
I have a textbox that gets assigned qty values but it appears as e.g. 126.000 and would like it to be 126.
any ideas?
Thanks
ASKER
i have tried converting and doesnt work...
if (dgr.PassQty < Convert.ToInt32(tbWorkOrde rQty.Text) )
if (dgr.PassQty < Convert.ToInt32(tbWorkOrde
Try this
int thisInt;
Int32.TryParse(tbWorkOrderQty.Text, out thisInt);
if (dgr.PassQty < thisInt)
{
//Your code
}
How do you assign the value to the textbox ? (In other words are formatting a string to force it show 3 decimal places in your code ?)
You say textbox. Do you mean edit OR maskededit box? A maskededit box has a mask property - which can be set to force decimal places to be shown.
You say textbox. Do you mean edit OR maskededit box? A maskededit box has a mask property - which can be set to force decimal places to be shown.
ASKER
simple...
tbWorkOrderQty.Text = tbWorkOrderQty.Text.Replac e(".000", "");
tbWorkOrderQty.Text = tbWorkOrderQty.Text.Replac
Simple - wouldn't it be better to make it work correctly at the start rather than patching it.
ps. If that works then it isn't a problem with a mask in a maskededit.
ps. If that works then it isn't a problem with a mask in a maskededit.
ASKER
it always come back with this .000 for every value and the textbox is a readonly so no one can edit it shouyld be fine
but what do you mean by mask edit?
but what do you mean by mask edit?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Open in new window
You can directly convert it to string by following code.
Open in new window