Re: Keypress

From: Rick Rothstein (rickNOSPAMnews_at_NOSPAMcomcast.net)
Date: 04/08/04


Date: Thu, 8 Apr 2004 11:24:08 -0400

I'm afraid you are not reading into the request far enough. I can't think of
an application where any arbitrary combination of digits and decimal points
would be acceptable (especially if you could corrupt it by pasting in
non-digits and non-decimal points). Also, I think you are being disingenuous
with your defense here since you obviously understood Mike to be asking for
floating point type numbers as your original response suggested a
MaskeEditBox which can't (at least I don't think it can) be configured to
accept the type of entry you are now suggesting the user wanted. Finally,
given Mike's reaction to the code I posted initially, I think we can safely
say he was looking for floating point number entries and not some random
combination of digits and dots.

Rick - MVP

"Neil Fallon" <nfallo@comcast.net> wrote in message
news:wOddc.99687$K91.230799@attbi_s02...
> Read the original post. You're reading things into it. He only wanted to
> allow numbers or decimal point. It was simple question.
>
> Neil
>
> "Björn Holmgren" <bjohol@hotmail.com> wrote in message
> news:I3ddc.36952$zm5.15696@nntpserver.swip.net...
> > "Neil Fallon" <nfallo@comcast.net> wrote in message
> > news:BAcdc.99339$K91.227951@attbi_s02...
> > > The code goes in to the KeyPress event of a textbox if you don't want
to
> > use
> > > a masked edit control. It traps the keys as they are being pressed,
but
> I
> > > suspect you knew that also but just wanted me to explain it to see if
I
> > knew
> > > what I was talking about.
> >
> >
> > If you take some time to really test that, you'll see that the reason
for
> > Rick's question is probably due to the fact that your code just doesn't
> work
> > all that well (no matter where you put it).
> >
> > For one thing, the user can still paste any text into the textbox using
> the
> > context menu. Another problem is that you can type stupid things like
> > "123.456.789".
> >
> > So, maybe all those lines of code were'nt that "unnecessary" after all,
> and
> > that "simple" task turned out to be a bit more complicated than it may
> have
> > appeared at first glance.
> >
> > --
> > Björn Holmgren
> > Guide Konsult AB
> >
> >
>
>



Relevant Pages

  • Re: Keypress
    ... digits or periods just as he had specified. ... Neil ... > say he was looking for floating point number entries and not some random ... You're reading things into it. ...
    (microsoft.public.vb.general.discussion)
  • Re: Cohens paper on byte order
    ... >> AND the direction from which one is reading, ... > If one doesn't assume an implicitly given endian-ness ... you feed it a string of digits. ... Note whether the number is little-endian or big-endian. ...
    (sci.crypt)
  • Re: Interesting math
    ... Floating point number represents a real number with 6 digits precision. ... Floating point numbers are denoted by the keyword float. ...
    (alt.usage.english)
  • Re: Gentler Decimal Floating-Point
    ... effectively change the radix of a decimal floating point ... under the heading "Logarithms all the time", ... logarithmic representation of numbers to be made workable for all the ... The middle digits are shifted only when the exponent, ...
    (comp.arch.arithmetic)
  • Re: Floating point subtraction rounding error (NOT display error)
    ... and apparently it's because floating point subtraction is having ... Notice that, to align both numbers at their decimal point, we had to discard the two less significant binary digits of 0.6. ... Note that this is the best result you can get with a limited precision of 53 bits, and it's not even Python who computes the value, but the underlying C math library. ...
    (comp.lang.python)