使用Visual Studio实现.NET的应用程序设计

1、首先当然是下载好Visual Studio软件啦!(2019版本)

2、新建一个名为StuMis的解决方案

3、在解决方案里面新建一个名为MK01的类库和一个名为MK02的类库

右键解决方案,选择新建项目,选择类库:

4、此时,其实StuMis并未引用到这两个类库

我们需要为StuMis引用到这两个类库:
右键引用,添加引用-->

打勾之后,点击确定:

5、查看是否成功引用

找到StuMis解决方案所在的文件目录,然后找到这个文件:

使用记事本方式打开它(记得提前启动一下奥):

引用成功!

6、编写具体的代码程序

点击按钮即可实现;

MK01:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MK01
{
    public class Class1
    {
        public int Add(int x,int y)
        {
            return (x + y);
        }
    }
}

Form1:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace StuMis
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {

        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void textBox3_TextChanged(object sender, EventArgs e)
        {
            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            int a = Convert.ToInt32(textBox1.Text);
            int b = Convert.ToInt32(textBox2.Text);

            textBox3.Text = Convert.ToString(a + b);
        }
    }
}
posted @ 2023-09-07 19:11  yesyes1  阅读(51)  评论(0编辑  收藏  举报