文本框的内容在按下回车键后判定输入内容错误,怎样让它里面的内容为选中状态呢???就是再次按回车键内容消失,从新能输入!!!!!????请教各位大侠指教一下!!!谢谢!!

解决方案 »

  1.   

    winform:
    this.textBox1.Focus();
    this.textBox1.Select();webform:(javascript)
    thisform.txt.focus();
    thisform.txt.selectall();
      

  2.   

    谢谢这位大哥,我试了试应该是
    this.textBox1.Selectall();小弟这样可以,谢谢!!还想请教一个问题,我用MassageBox.Show("结束!");
    但系统说没有添加引用,我就是想弹出一个对话框!!!请问怎么办??谢谢
      

  3.   

    winform:messageBox
    webform:javascript alert
      

  4.   

    var flg=0;
    function check(value)
    {
    if(value.length!=4)
    {
    flg=1;
    return false;
    }
    else
    {
    return true;
    }
    }
    function onEnter()
    {
    if(event.keyCode == 13)
    {
     var v=document.all.txt1.value;
    if (flg==1)
    {
     document.all.txt1.value="";
     document.all.txt1.focus();
     flg=0;
     return false;
    }
    else
    {
    if(!check(v))
    {
    document.all.txt1.focus();
    document.all.txt1.select();
    return false;
    }
    else
    {
    return true;
    }
    }
    }
    }
      

  5.   

    MassageBox.Show 要用的话需要添加什么引用????提示错误是缺少using指令和程序集引用
    需要添加什么引用呢?
      

  6.   

    Using System.Windows.Forms ;
      

  7.   

    我引用了啊!但是我用MassageBox.Show 
    错误:
    D:\prject\meprj\Solution1\WindowsApplication2\Form1.cs(257): 找不到类型或命名空间名称“massageBox”(是否缺少 using 指令或程序集引用?)
    不知道怎么回事?请大侠指教一下!!
      

  8.   

    是MessageBox.Show
    不是MassageBox.Show