For Programmers: Free Programming Magazines  


Home > Archive > Visual Basic > January 2006 > Text Box Problem









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Text Box Problem
Pinto1uk

2006-01-29, 6:55 pm

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



Lance Wynn

2006-01-29, 6:55 pm

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 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




Pinto1uk

2006-01-29, 6:55 pm

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:

> 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 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
>
>
>
>
>

David Clifford

2006-01-29, 6:55 pm

try
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[color=darkred]
> errornous.
>
> regards
>
> "Lance Wynn" wrote:
>
below[color=darkred]
i[color=darkred]


J French

2006-01-30, 3:55 am

On 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
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com