Code Comments
Programming Forum and web based access to our favorite programming groups.Hi, can anyone tell me why the following line of code does not work. It work s for example whenever the txtAmount > 1. but if i enter enter anything below 1, the code does not perform the way i want. the code does not work when i play around with decimal numbers. If txtAmount.Text < Val (txtTotal.Text) Then ... regards
Post Follow-up to this messagetry If Val(txtAmount.Text) < Val (txtTotal.Text) Then "Pinto1uk" <Pinto1uk@discussions.microsoft.com> wrote in message news:A9B41128-DC8E-4FF3-BB80-02F3C8A9AAFE@microsoft.com... Hi, can anyone tell me why the following line of code does not work. It works for example whenever the txtAmount > 1. but if i enter enter anything below 1, the code does not perform the way i want. the code does not work when i play around with decimal numbers. If txtAmount.Text < Val (txtTotal.Text) Then ... regards
Post Follow-up to this messageHi, ive tried that with no luck. the problem occurs only when the total is less than 1. eg £0.90. and when i try and enter 0.95, the calculation becom es errornous. regards "Lance Wynn" wrote: > try > > If Val(txtAmount.Text) < Val (txtTotal.Text) Then > > "Pinto1uk" <Pinto1uk@discussions.microsoft.com> wrote in message > news:A9B41128-DC8E-4FF3-BB80-02F3C8A9AAFE@microsoft.com... > Hi, can anyone tell me why the following line of code does not work. It > works > for example whenever the txtAmount > 1. but if i enter enter anything belo w > 1, the code does not perform the way i want. the code does not work when i > play around with decimal numbers. > > If txtAmount.Text < Val (txtTotal.Text) Then ... > > regards > > > > >
Post Follow-up to this messagetry If Val(Mid((txtAmount.Text), 2)) < Val(Mid((txtTotal.Text), 2)) Then I think that it may be the "£" that is the problem "Pinto1uk" <Pinto1uk@discussions.microsoft.com> wrote in message news:D1B60C4C-A90F-4EA2-958E-5CE232172D79@microsoft.com... > Hi, ive tried that with no luck. the problem occurs only when the total is > less than 1. eg £0.90. and when i try and enter 0.95, the calculation becomes > errornous. > > regards > > "Lance Wynn" wrote: > below i
Post Follow-up to this messageOn Sun, 29 Jan 2006 22:20:38 -0000, "David Clifford" <sarpg939tNoSpam@SomeISP.com> wrote: >try >If Val(Mid((txtAmount.Text), 2)) < Val(Mid((txtTotal.Text), 2)) Then > >I think that it may be the "£" that is the problem Yes, Val( "£100" ) is zero The OP would be better off disallowing or removing non numeric characters
Post Follow-up to this message
Show a Printable Version
Email This Page to Someone!
Receive updates to this thread
Powered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.