首先,我想指出我知道这个话题已经有其他几个问题了,而且我之前也做过这件事。但我在这里提问是因为我不知道我的问题在哪里。
以下是我尝试显示新用户控件的代码:
private void ValidationLabel_Click(object sender, EventArgs e)
{
EntrySuggestion t_ES = new EntrySuggestion();
t_ES.Show();
MainScreen home = new MainScreen();
home.Show();
}
我试图让 t_ES 显示出来(目前未能显示),但主屏幕可以。这两者都是用户控件。
以下是我的 EntrySuggestion 用户控件代码:
using System;
using System.Collections;
using System.Windows.Forms;
namespace TeamManagementSystem
{
public partial class EntrySuggestion : UserControl
{
private ArrayList items = new ArrayList();
public EntrySuggestion()
{
InitializeComponent();
}
public EntrySuggestion(ArrayList i)
{
InitializeComponent();
items = (ArrayList)i.Clone();
}
private void EntrySuggestion_Load(object sender, EventArgs e)
{
foreach (string item in items)
{
RadioButton t_RB = new RadioButton();
t_RB.Text = item;
ItemSuggestionTable.Controls.Add(t_RB);
}
}
}
}
我希望使用第二个构造函数,但无论如何都无法使其正常工作。如果有任何帮助,将不胜感激。