C#入门经典
private void textBoxSize_KeyPress(object sender, KeyPressEventArgs e)
        {
            if ((e.KeyChar < 48 || e.KeyChar > 57) && e.KeyChar != 8 && e.KeyChar != 13)
            {
                e.Handled = true;
            }
            else if (e.KeyChar == 13)
            {
                TextBox txt = (TextBox)sender;
                if (txt.Text.Length > 0)
                    ApplyTextSize(txt.Text);
                e.Handled = true;
                this.richTextBoxText.Focus();
            }
        }
调试的时候提示:
当前上下文不存在ApplyTextSize
在网上看了好多,貌似其它人的没有我这种情况,难道是我的vs2005有问题?
麻烦各位高手赐教咯

解决方案 »

  1.   

    ApplyTextSize  , 你没有写这个方法, 怎么可能调用咧。
      

  2.   

    你仔细检查下书里的代码, 有没有这个ApplyTextSize方法, 是你没注意加上去, 还是留下来让你自己写的。?
      

  3.   

    非常感谢Ghost_Khz
    是我自己大意了,没有看到后面还有ApplyTextSize()这个方法,自己就急着调试了 
      

  4.   

    Ghost_Khz非常抱歉,  因为是新注册的号,现在我还是0积分,等过24小时我就无满意结贴了,算我欠你20积分,以后有了一定还你,请多包涵~