日期:2014-05-18  浏览次数:21160 次

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;}