且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

C#将控件添加到控件中...

更新时间:2021-06-28 07:54:08

我不会那样做.我将TextBox放在窗体上,然后将其隐藏直到需要为止(当用户单击button1时).更好的是,我将其放在表单上并只是将其禁用.当新控件出现在无处不在"且出于未知原因时,用户不喜欢它.

除此之外,您的问题还不清楚.您是什么意思我不知道应该在那里"?
I wouldn''t do it that way. I''d put the TextBox on the form, and then hide it until it''s needed (when the user clicks button1). Even better, I''d put it on the form and just disable it. Users don''t like it when new controls appear "out of nowhere" and for unknown reasons.

Beyond that, your question is unclear. What do you mean by "I don''t think I know what should be there"?


问题是您正在尝试对自身进行myNewtextbox(第二行)在您的方法中).您需要添加到其他Control中,通常是PanelForm.

—SA
The problem is that you''re trying to myNewtextbox to itself (in second line inside your method). You need to added to some other Control, typically a Panel or a Form.

—SA