using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using 深度OAC.Data ;
using System.Windows.Forms;namespace 深度OAC
{
    public partial class editdata : UserControl
    {
        public editdata()
        {
            InitializeComponent();
        }        public string tablename
        {
            get
            {
                return tablename ;
            }
            set
            {
                tablename = value;
            }
        }        private void editdata_Load(object sender, EventArgs e)
        {
            string sql = "select * from " + tablename;
            DBOperate.BindDataGridView(dataGridView1, sql);
        }
    }
}
在一个from中把自己的控件加入
并使用editdata.tablename="xxx"vs2008直接退出,没有任何提示,为干什么?

解决方案 »

  1.   

    退出没有提示?什么意思一般属性这样写把private string _tablename = "";public string tablename 
        {
            get { return _tablename; }
            set { _tablename = value; }
        }
      

  2.   

       private string _tablename;
            public string tablename
            {
                get
                {
                    return _tablename;
                }
                set
                {
                    _tablename = value;
                }
            }        private void editdata_Load(object sender, EventArgs e)
            {
                string sql = "select * from " + _tablename;
                
            }