自己写的一个控件无法使用

20004 2011-01-15 10:40:48
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直接退出,没有任何提示,为干什么?
...全文
57 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
doubleu2005 2011-01-15
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 rczjp 的回复:]

退出没有提示?什么意思

一般属性这样写把

C# code
private string _tablename = "";

public string tablename
{
get { return _tablename; }
set { _tablename = value; }
}
[/Quote]
+1
LZ的写法不对
wuyq11 2011-01-15
  • 打赏
  • 举报
回复
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;

}
rczjp 2011-01-15
  • 打赏
  • 举报
回复
哦,只是变量的习惯写法而已,呵呵
20004 2011-01-15
  • 打赏
  • 举报
回复
这里的_代表什么意思呢?
rczjp 2011-01-15
  • 打赏
  • 举报
回复
退出没有提示?什么意思

一般属性这样写把

private string _tablename = "";

public string tablename
{
get { return _tablename; }
set { _tablename = value; }
}

110,534

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧