首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

c# 自定义控件有关问题

2012-05-04 
c# 自定义控件问题我新增了一个自定义控件是一个BUTTON然后在这BUTTON里加了三个属性分别是fid,fcod,fdest

c# 自定义控件问题
我新增了一个自定义控件是一个BUTTON然后在这BUTTON里加了三个属性分别是fid,fcod,fdest系统自动生成的代码为:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace zb
{
  public partial class UC : UserControl
  {
  public UC()
  {
  InitializeComponent();
  }

  /// <value></value>
  public string fid
  {
  get
  {
  throw new System.NotImplementedException();
   
  }
  set
  {
   
  }
  }

  public string fcod
  {
  get
  {
  throw new System.NotImplementedException();
  }
  set
  {
  }
  }

  public string fdes
  {
  get
  {
  throw new System.NotImplementedException();
  }
  set
  {
  }
  }

  private void button1_Click(object sender, EventArgs e)
  {

  }
  }
}


我在另外一个FORM中添加了uc1.fid = MyDataSet.Tables[0].Rows[0]["fid"].ToString();进行赋值


当我想用MessageBox.Show(uc1.fid );显示出值来时老是出错提示 : 未处理NotImplementedException
未实现该方法或操作
MyDataSet.Tables[0].Rows[0]["fid"].ToString()的值是1已经在另一个按钮的TEXT里显示出来了
请问我这是里里出问题了?

[解决办法]
把自动生成的代码
throw new System.NotImplementedException();去掉
改成 
public string fid{get;set;}
 
 

热点排行