Ensuring an edit control contains numbers only

Ensuring an edit control contains numbers only

Post by Sinead Armstron » Sat, 14 Jul 2001 17:49:24



Is there any way that an edit control can be set up (or checked) so that
it only accepts integers? In my example, I have an edit box which
appears on a page of my wizard and when the 'Next>' button is pressed, I
want to ensure that the value that has been added into the edit box is a
number. Hope someone can help - I'm hoping it has been done before!

Thanks for your time,

Sinead Armstrong (Ireland)

 
 
 

Ensuring an edit control contains numbers only

Post by PaoloItal » Sat, 14 Jul 2001 18:10:46


void __fastcall TForm1::Edit1KeyPress(TObject *Sender, char &Key)
{
  if(!isdigit(Key))
  {
    Key = 0;
    Beep();
  }

Quote:}

Ciao


Quote:> Is there any way that an edit control can be set up (or checked) so that
> it only accepts integers? In my example, I have an edit box which
> appears on a page of my wizard and when the 'Next>' button is pressed, I
> want to ensure that the value that has been added into the edit box is a
> number. Hope someone can help - I'm hoping it has been done before!

> Thanks for your time,

> Sinead Armstrong (Ireland)


 
 
 

Ensuring an edit control contains numbers only

Post by Sinead Armstron » Sat, 14 Jul 2001 19:56:31


Grazie mille, Paolo!

Sinead


> void __fastcall TForm1::Edit1KeyPress(TObject *Sender, char &Key)
> {
>   if(!isdigit(Key))
>   {
>     Key = 0;
>     Beep();
>   }
> }

> Ciao


> > Is there any way that an edit control can be set up (or checked) so that
> > it only accepts integers? In my example, I have an edit box which
> > appears on a page of my wizard and when the 'Next>' button is pressed, I
> > want to ensure that the value that has been added into the edit box is a
> > number. Hope someone can help - I'm hoping it has been done before!

> > Thanks for your time,

> > Sinead Armstrong (Ireland)

 
 
 

1. sending the output of a Timer control to a edit box control

Hi,

I'm writing a pedagogical program to compare binary vs. linear searches
and I'm trying to use a timer control.  Enabling and disabling the timer
is no problem.  The problem I am having is in sending the timer value to
a edit box control.  The code for the linear search is given below.  )A
search value is entered and an array (external to the search function is
searched for the value.  The search works fine.  The problem is just in
how I'm handling the timer).  I have searched the available newsgroup
posts for a similar problem and have found none at this time.

void __fastcall TForm1::LinearClick(TObject *Sender)
{
    Timer1->Enabled=true;
    int SearchNum = StrToInt(SearchNumber->Text);

    for (int i = 0; i < sizea; i++)
    {
        if (SearchNum == a[i])
        {
            ArrayOut->Text = "Number found at position " + IntToStr(i);
            break;
        }
    Timer1->Enabled=false;
    TimeOut->Text = IntToString(Timer1);                 //
<<<<<<<<<<<<< error occures here
    ArrayOut->Text = "Search Number is not in the array";
    }

Any help would be greatly appreciated.
Steven

2. *** SpotLights on 3Dup.com - (November 15, 1999) ***

3. Printing a picturebox when it contains controls.

4. Q:Is there any converting tools to convert Explore, Wavefront , SoftImage format to Renderman?

5. Controlling index numbers in grayscale mask images

6. Height Field

7. Number Characters to fit in control

8. Curve/path editing without use of control points

9. DV/Hi-8 Editing Control Update

10. Image Edit Control (ocx)

11. Edit controls in cinema4dxl

12. Drawing on top of Edit controls