我试图将找到的结果输出到选项卡控件中的标签。但它根本不显示它们。有人可以看看我的代码并告诉我我做错了什么吗?谢谢你。
private void btnSearch_Click(object sender, EventArgs e)
{
int indexResult = 0;
string title, id;
double price;
string a = txtSearch.Text;
if (Xbox360.HaveGame(a, ref indexResult))
{
title = Xbox360.GetTitle()[indexResult];
Results.SetTitle(title);
id = Xbox360.GetId()[indexResult];
Results.SetId(id);
price = Xbox360.GetPrice()[indexResult];
Results.SetPrice(price);
}
if (Ps3.HaveGame(a, ref indexResult))
{
title = Ps3.GetTitle()[indexResult];
Results.SetTitle(title);
id = Ps3.GetId()[indexResult];
Results.SetId(id);
price = Ps3.GetPrice()[indexResult];
Results.SetPrice(price);
}
if (Wii.HaveGame(a, ref indexResult))
{
title = Wii.GetTitle()[indexResult];
Results.SetTitle(title);
id = Wii.GetId()[indexResult];
Results.SetId(id);
price = Wii.GetPrice()[indexResult];
Results.SetPrice(price);
}
// Basically I am going to output the result from the array Results, however,
// here I just want to output a sample string
for (int i = 0; i < 3; i++)
{
Label resultLabel = new Label();
resultLabel.Location = new Point(10, 7);
resultLabel.Text = "output is here";
this.Controls.Add(resultLabel);
}
}