我用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....... //这句不能引用那个属性?
}
}
}
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....... //这句不能引用那个属性?
}
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货