文本框中的撇号问题 [英] problem with the apostrophe in a text box

查看:112
本文介绍了文本框中的撇号问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这里是代码

  if  char  .IsLetter(e.KeyChar)|| e.KeyChar ==  8  || e.KeyChar ==  '  $' || e.KeyChar == '   - ' || e.KeyChar == ' ' || e。 KeyChar == ' ' ' 
{
e.Handled = false;
}
其他
{
e.Handled = true;
}





我希望该名称文本框也应该接受撇号,我该怎么做?如果我添加e.keychar =='''我得到一个错误

解决方案

' || e.KeyChar == ' - ' || e.KeyChar == ' ' || e.KeyChar == ' ' '
{
e.Handled = false;
}
其他
{
e.Handled = true;
}





我希望该名称文本框也应该接受撇号,我该怎么做?如果我添加e.keychar =='''我收到错误


:笑:

逃脱它:

  if  char  .IsLetter(e.KeyChar)|| e.KeyChar = =  8  || e.KeyChar == '  


' || e.KeyChar == ' - ' || e.KeyChar == ' ' || e.KeyChar == ' \''
{
e.Handled = ;


here is the code

if (char.IsLetter(e.KeyChar) || e.KeyChar == 8 || e.KeyChar == '$' || e.KeyChar == '-' || e.KeyChar == ' ' || e.KeyChar == ' ' ')
           {
               e.Handled = false;
           }
           else
           {
               e.Handled = true;
           }



i want that name textbox should also accept the apostrophe,how can i do that? if i add e.keychar==' ' ' i get an error

解决方案

' || e.KeyChar == '-' || e.KeyChar == ' ' || e.KeyChar == ' ' ') { e.Handled = false; } else { e.Handled = true; }



i want that name textbox should also accept the apostrophe,how can i do that? if i add e.keychar==' ' ' i get an error


:laugh:
Escape it:

if (char.IsLetter(e.KeyChar) || e.KeyChar == 8 || e.KeyChar == '


' || e.KeyChar == '-' || e.KeyChar == ' ' || e.KeyChar == '\'') { e.Handled = false;


这篇关于文本框中的撇号问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆