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

How to Share webservice object to all user

How to fix error Msg 1801, Level 16, State 3, Line 1