谁遇到这个错误提示.内详

BossFriday 2009-02-24 03:20:42
错误提示:'child' is not a child control of this parent

如果遇到过的朋友,请解释一下.
谢谢.
...全文
130 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
EveryCase 2009-02-25
  • 打赏
  • 举报
回复
顶~~~~~~~~~~~
y002150 2009-02-24
  • 打赏
  • 举报
回复
没有继承吗?
Cherishny 2009-02-24
  • 打赏
  • 举报
回复
没遇到过
http://social.msdn.microsoft.com/Forums/en-US/winformsdesigner/thread/79b17d53-2b30-4bce-86e5-87c51191321e/
BossFriday 2009-02-24
  • 打赏
  • 举报
回复
是否VB和C#在这样的情况下,运行时候有差异呢?

VB
Public Sub New(ByVal context As DisplayContext)
MyBase.New(context, New NewUserAccountWizardManager(context.CallContext)) InitializeComponent()
End Sub

c#
public FormNewUserAccount(DisplayContext context)
: base(context, new NewUserAccountWizardManager(context.CallContext)) {
InitializeComponent();
}

在vb版本下,没有问,在C#版本下就出上面的错误.
qinhl99 2009-02-24
  • 打赏
  • 举报
回复
参考下下面的代码?
特别是下面的这一行:propParent.SetValue(m_customcomponent, host.RootComponent);




IComponent m_customcomponent;
PropertyDescriptorCollection props;
PropertyDescriptor propParent;

foreach (DictionaryEntry m_icomponent in m_qdictionary)

{

string m_assemblyname = m_icomponent.Value.GetType().Name;

switch (m_assemblyname)

{

case "QLabel":

QLabel m_qlabelcomponent = (QLabel)m_icomponent.Value;

m_customcomponent = host.CreateComponent(typeof(QLabel));

//Find the properties for the label control

props = TypeDescriptor.GetProperties(m_qlabelcomponent);

//We assign the properties from serialized object to the new component.

((QLabel)m_customcomponent).Texto = (string)props["Texto"].GetValue(m_qlabelcomponent);

((QLabel)m_customcomponent).Nombre = (string)props["Nombre"].GetValue(m_qlabelcomponent);

// other properties

//Get the Parent property

propParent = props["Parent"];

//Set the Parent property to the form:

propParent.SetValue(m_customcomponent, host.RootComponent);


break;

case "QImage":

break;

//another members and code ommited...

}

}


aemyang1987 2009-02-24
  • 打赏
  • 举报
回复
可以理解为1. 'child'不属于当前定义,可能在其他地方定义或无定义
2.child不是使用控件的子控件
其实就是控件的没有定义!
浮生若梦丶 2009-02-24
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 zzq1996 的回复:]
'child'不属于当前定义,可能在其他地方定义或无定义
[/Quote]
up
浮生若梦丶 2009-02-24
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 zzq1996 的回复:]
'child'不属于当前定义,可能在其他地方定义或无定义
[/Quote]
up
shxmh 2009-02-24
  • 打赏
  • 举报
回复
child不是使用控件的子控件
zzq1996 2009-02-24
  • 打赏
  • 举报
回复
'child'不属于当前定义,可能在其他地方定义或无定义

110,538

社区成员

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

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

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