用C#写了一个简单的程序

今天下午把昨天学的东西,实践了一下。写了一个简单的2个数字的加减乘除计算器。

代码已经上传到了网络硬盘里面,有兴趣的初学者可以看看,我本来想声明一个全局变量,后来搜索了一下MSDN,发现C#是没有全局变量的,就老老实实地在每个事件里面声明。虽然笨拙一点,但是保险。

也希望高手指点一二。呵呵。

    private void button1_Click(object sender, EventArgs e)
            {
                //加法运算
                Double x, y, result;
                x = Convert.ToDouble(txtUsr.Text);
                y = Convert.ToDouble(txtPwd.Text);
                result = x + y;
                MessageBox.Show(result.ToString());
            }</textarea>

            private void button2_Click(object sender, EventArgs e)
            {
               //点击reset复位所有文本框内容
                txtUsr.Text = “”;
                txtPwd.Text = “”;
            }

            private void button6_Click(object sender, EventArgs e)
            {
                //点击QUIT退出程序
                Application.Exit();
            }

            private void button3_Click(object sender, EventArgs e)
            {
                //减法运算
                Double x, y, result;
                x = Convert.ToDouble(txtUsr.Text);
                y = Convert.ToDouble(txtPwd.Text);
                result = x – y;
                MessageBox.Show(result.ToString());
            }

            private void button4_Click(object sender, EventArgs e)
            {
                Double x, y, result;
                x = Convert.ToDouble(txtUsr.Text);
                y = Convert.ToDouble(txtPwd.Text);
                result = x * y;
                MessageBox.Show(result.ToString());
            }

            private void button5_Click(object sender, EventArgs e)
            {
                //除法,因为除数为0没有意义,所以用了条件语句
                Double x, y, result;
                x = Convert.ToDouble(txtUsr.Text);
                y = Convert.ToDouble(txtPwd.Text);
                if (y == 0)
                {
                    MessageBox.Show(“Sorry,there is an error!”);
                }
                else
                {
                    result = x / y;
                    MessageBox.Show(result.ToString());
                }
            }

微软宣布Visual Studio 2005 Express永久免费

""

微软今天宣布免费的Visual Studio 2005 Express Edition自发布的四个多月来已经获得了500万的下载量,同时表示该产品将永久免费。

微软原计划为2005年11月7日发布的Visual Studio 2005 Express Edition提供一年的免费期,但在价格确定前,微软决定继续维持免费政策不变,并且没有时间限制。

Visual Studio 2005 Express Edition 是一个产品套装,包括Visual Basic、Visual C#、Visual J、Visual C++、 Visual Web Developer Express等多个套件。500万的下载中同时包括免费版SQL Server Express的下载量。

微软表示,坚持免费的主要原因是为了感谢开发社区的成员。

此外,为了鼓励全球约1800万个人开发者,微软通过MSDN开设了Coding4Fun网站,为开发新手提供学习资料和相关信息。

下面两个网站应该收录,里面学习资源,还有免费的视频教程,不过是english的,没关系,只要能看懂过程就可以了。我下载了几个初学者的课程,非常不错,简单易懂,适合对编程没有任何经验的初学者。

http://www.microsoft.com/china/msdn/express/

http://www.learnvisualstudio.net/

学习了ASP和ASP.NET的一点心得

今天从网络上主要看了一下ASP的教程,看的不是很深,仅仅介绍了ASP的几个对象和方法,还有简单的几个例子。不过从网络看的10天学会ASP.net非常不错,很适合速成。

也对新手容易出现的问题,文章中都一一列举出来了,尤其是用C#开发ASP.NET的时候,特别明显.因为很容易忘记大小写和分号,以及传递参数的时候使用圆括号。但是文章中谈到的验证控件,似乎没有,因为当我执行代码的时候报错,好像在System.Web.UI.WebControls里面没有validater这样的控件。下面贴出错误消息:

Parser Error

Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. Parser Error Message: Could not load type System.Web.UI.WebControls.RequireFieldValidator from assembly System.Web, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a.

看完这个10天学会ASP.NET后,我是信心大增啊,没有想到原来也可以这样简单.当然,学过之后的应用仍然是需要锻炼和总结的.

下面给出几个比较有用的连接:

http://www.ddvip.com/

http://www.chinaasp.com/

http://www.ibook8.com/

希望各位能找到自己需要的东西.