| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 692 人关注过本帖
标题:string to int32的问题
取消只看楼主 加入收藏
有敌手
Rank: 1
等 级:新手上路
帖 子:41
专家分:0
注 册:2008-2-12
收藏
 问题点数:0 回复次数:0 
string to int32的问题
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace 小学加减
{
    public partial class Form1 : Form
    {
        int count = 0;

        public Form1()
        {
            InitializeComponent();
        }


        private void button2_Click(object sender, EventArgs e)
        {
            string temp = count.ToString();
            string ab = "你做对了" + temp + "道题";
            MessageBox.Show(ab);
           
        }

        private void button1_Click(object sender, EventArgs e)
        {
            
            int result;
            Random r = new Random();

            int i = r.Next(0, 20);
            int j = r.Next(0, 20);


            
            if (j < 0)
            {
                j = Math.Abs(j);
                string x = Convert.ToString(i);
                string y = Convert.ToString(j);

                textBox1.Text = x + " - " + y;
            }

            else
            {
                string x = i.ToString();
                string y = j.ToString();

                textBox1.Text = x + " + " + y;
            }
            //MessageBox.Show(textBox2.Lines[0]);
            result = Convert.ToInt32(textBox2.Lines[0]);



            if (result  == i + j)
            {
                MessageBox.Show("OK");
                count++;
            }

            textBox2.Clear();



        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button3_Click(object sender, EventArgs e)
        {
            Random r = new Random();

            int i = r.Next(0, 20);
            int j = r.Next(0, 20);



            if (j < 0)
            {
                j = Math.Abs(j);
                string x = Convert.ToString(i);
                string y = Convert.ToString(j);
                textBox1.Text = x + " - " + y;
            }

            else
            {
                string x = i.ToString();
                string y = j.ToString();
                textBox1.Text = x + " + " + y;
            }
        }
    }
}

红色的代码始终无法执行,请问是为什么?
搜索更多相关主题的帖子: string 
2008-10-23 22:28
快速回复:string to int32的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.012404 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved