用户控件

hbpqwxh 2010-11-02 10:46:22
我用C#2005建了一个用户控件,放在一个新的类库里,加完属性后,却不能在其他的名称空间引用使用,不知道错在什么地方,请大家帮忙!
namespace GanTeTu.Control
{
public partial class Gantt_Cont : UserControl
{
public Gantt_Cont()
{
InitializeComponent();
}

private DateTime DT_CurrentTime;
public DateTime GetSystem_CurrentTime
{
get
{
DT_CurrentTime = System.DateTime.Now;
return DT_CurrentTime;
}
set
{
DT_CurrentTime = value;
}
}
}


public class Gantt_Public_Porperity
{
private DateTime DT_CurrentTime;
public DateTime GetSystem_CurrentTime
{
get
{
DT_CurrentTime = System.DateTime.Now;
return DT_CurrentTime;
}
set
{
DT_CurrentTime = value;

}
}
}

}



引用时
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using GanTeTu.Control;

namespace Gantt_Form
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)
{
//MessageBox.Show (GanTeTu.Control.Gantt_Public_Porperity....... //这句不能引用那个属性?
}
}
}
...全文
154 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
三傻云梦 2010-11-02
  • 打赏
  • 举报
回复
I can't agree with you more
三傻云梦 2010-11-02
  • 打赏
  • 举报
回复
I can't agree with you more
zhengjianhua520 2010-11-02
  • 打赏
  • 举报
回复
实例化, 加载到现在要用的窗体里
ima_zhan 2010-11-02
  • 打赏
  • 举报
回复
定义一个实例,加到Form1中
_Will_ 2010-11-02
  • 打赏
  • 举报
回复
Gantt_Cont 少了个类名吧 而且要实例化的

111,129

社区成员

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

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

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