c#设计QQ页面,出现这种问题怎么解决

c#设计QQ页面,出现这种问题怎么解决

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

namespace WindowsFormsApp6
{
    public partial class Form1 : Form
    {
        public Hashtable h = new Hashtable();
        private string qq;
        private string pwd;
        public Form1()
        {
            InitializeComponent();
            h["123456"] = "123456";
            h["111111"] = "111111";
        }

        private void button1_Click(object sender, EventArgs e)
        {

        }

        private void button1_Layout(object sender, LayoutEventArgs e)
        {

        }

        private void button1_Click_1(object sender, EventArgs e)
        {

        }

        private void Form1_Load(object sender, EventArgs e)
        {
            txtQQ.Text = "QQ号";
            txtPwd.Text = "密码";
        }

        private void txtQQ_Enter(object sender, EventArgs e)
        {
            txtQQ.Text = "";
        }

        private void txtPwd_Enter(object sender, EventArgs e)
        {
            txtPwd.Text = "";
            txtPwd.PasswordChar = '*';
        }

        private void button2_Click(object sender, EventArgs e)
        {
            bool flag1 = false;
            bool flag2 = false;
            foreach (string q in h.Keys)
            {
                if (q == qq)
                {
                    flag1 = true;
                    if ((string)h[qq] == pwd)
                        flag2 = true;
                }

            }
            if (flag1 != true)
            {
                MessageBox.Show("QQ号错误,请重新输入");
                txtQQ.Text = "";
                txtQQ.Focus();
            }
            else if (flag2 != true)
            {
                MessageBox.Show("密码错误,请重新输入");
                txtPwd.Text = "";
                txtPwd.Focus();
            }
            else
            {
                Form2 f2 = new Form2();
                f2.Show();
            }

        }

        private void txtQQ_TextChanged(object sender, EventArgs e)
        {
            qq = txtQQ.Text;

        }

        private void txtPwd_TextChanged(object sender, EventArgs e)
        {
            pwd = txtPwd.Text;
        }
    }
}

img

这个就是缺少对Form1窗口和Form2窗口的引用,编译时指定页面无法找到Form1和Form2相关类,故报错。
解决:在Program.cs / QQ.cs头部引入Form1和Form2的命名空间/或程序集即可,如Using Form1; .........