using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.CodeDom;
namespace 停车场系统1._0
{
    public partial class Mainform : Form
    {
        public Mainform()
        {
            InitializeComponent();
        }
        Stack<string> a = new Stack<string>(5);
        Stack<string> b = new Stack<string>(5);//辅助栈
        Queue<string> c = new Queue<string>(1);
        private void label1_Click(object sender, EventArgs e)
        {        }        private void Mainform_Load(object sender, EventArgs e)
        {        }        private void button1_Click(object sender, EventArgs e)
        {
           Parking  parking = new Parking();
           try
           {
               Parking.ShowDialog();
           }
           finally
           {
               Parking.Dispose();
           }        }       
    }
}
我已经写了命名空间为什么Parking.ShowDialog();Parking.Dispose();还会报错,要求对象引用啊?

解决方案 »

  1.   

    using System.CodeDom;
    这个是你写的using 吗  
    关写这个不行  看看你项目中  有个引用   右键添加引用 把这个dll或类库添加进去 using才能有效
      

  2.   

    既然提示是引用的问题 十有八九就是这里的问题  或者你的方法根本在那个dll是不存在的  你自己再好好的检查下
      

  3.   


    错误 1 非静态的字段、方法或属性“System.Windows.Forms.Form.ShowDialog()”要求对象引用 D:\大二下\c#   test\停车场系统\停车场系统\MainForm.cs 29 17 停车场系统
      

  4.   

     Parking  parking = new Parking();
               try
               {
                   Parking.ShowDialog();
               }
               finally
               {
                   Parking.Dispose();
               }try里面的改成小写试试~ 另外Parking里面有 ShowDialog()这个方法吗?