ascii - Modifying VB.NET NumericKeyPress event code to C++ -


can modify me?

private sub numerickeypress(byval sender system.object, byval e system.windows.forms.keypresseventargs) handles textbox1.keypress         if e.keychar = chr(keys.back)         else             if not char.isdigit(e.keychar)                 e.handled = true                 beep()             else                 if len(textbox1.text) > 0                     if val(textbox1.text) > 105097565                         e.handled = true                         beep()                     end if               end if                     end if          end if     end sub 

or tell me how is: 1.numerickeypress event? 2.how e.keychar? 3.how isdigit? 4.how chr(ascii number)? 5.how handle e.key? 6.how system beep?

i tried:

private: system::void textbox1_keypress( object^ sender, system::windows::forms::keypresseventargs^ e )                 {                     if(e->keychar == (char)8)                     {}                     else                      {                     if (!char::isdigit(e->keychar))                     {                     e->handled = true;                     }                     else                     {                     if (textbox1->text->length > 0)                     {                     if (int::parse(textbox1->text) > 105097565)                     {                     e->handled = true;                     }                     }                     }                     }                  }  

but didn't work.

i added

this->textbox1->keypress += gcnew system::windows::forms::keypresseventhandler(this, &myform::textbox_keypress); 

to

#pragma region windows form designer generated code         void initializecomponent(void) 

Comments

Popular posts from this blog

how to insert data php javascript mysql with multiple array session 2 -

multithreading - Exception in Application constructor -

windows - CertCreateCertificateContext returns CRYPT_E_ASN1_BADTAG / 8009310b -