Still same problem


do replace e.keycode e.keychar. tried , didn't work? still hadn't figured out.

 

here error message

 operator '<' cannot applied operands of type 'char' , 'system.windows.forms.keys'

private void textbox3_keypress(object sender, system.windows.forms.keypresseventargs e)

{

if (e.keychar < keys.d0 || e.keychar > keys.d9)

{

textbox3.text = "_";

}

}

 

hello all.

redlightpacket:

you have remember, .net strong types.  e.keychar returns type "char", , keys returns "system.windows.forms.keys", enumeration.

if recall docs, there no implicit type casts applied enumerations.  have use explicit type cast, this:

if (e.keychar < (char)keys.d0 || e.keychar > (char)keys.d9)

this way, comparing items of same type.

hth.



.NET Framework  >  Common Language Runtime Internals and Architecture



Comments

Popular posts from this blog

Azure DocumentDB Owner resource does not exist

job syspolicy_purge_history job fail in sqlserver 2008

Trying to register with public marketplace error with 'Get-AzureStackStampInformation'