so,
im试图让我的输入框提示用户输入一周(1-4,at int)和一天(在周一至周五之间,作为字符串),然后进入我的数组,并输出索引到文本框。我在C#和使用Windows表单应用程序中对此进行编码。
我的代码如下:
txtOutput.Text += "Filling the array with user input..." + "rn";
txtOutput.Text += "The product allocation is as follows:" + "rn";
string[,] toys = new string[5, 4];
for (int week = 0; week <= 3; week++)
{
for (int day = 0; day <= 4; day++)
{
toys[day, week] = Microsoft.VisualBasic.Interaction.InputBox("Please enter value for Day " + Convert.ToString(day + 1) + " in week " + Convert.ToString(week + 1) + ".");
}
}
txtOutput.Text += "tt" + "Mon" + "t" + "Tue" + "t" + "Wed" + "t" + "Thu" + "t" + "Fri" + "t" + "rn";
for (int week = 0; week <= 3; week++)
{
txtOutput.Text += "Week " + (week + 1) + "t";
for (int day = 0; day <= 4; day++)
{
txtOutput.Text += toys[day, week];
if (day != 4)
{
txtOutput.Text += "t";
}
}
txtOutput.Text += "rn";
}
这基本上是我的数组,收集所有信息,存储它,输出它,现在我试图使我的输入框提示某个一天/周,然后输出。
在想我会使用这条线然后围绕它工作吗?
Microsoft.VisualBasic.Interaction.InputBox("Please enter value for Day " + Convert.ToString(day + 1) + " in week " + Convert.ToString(week + 1) + ".");
问题
im试图使VisualBasic输入框要求用户输入一天和一周,然后转到我的数组,找到值并将其输出到我的文本框中。
没有C#等效。您有两个选项:创建自定义表单或参考VisualBasic并调用输入框。
,而不是在值中输入为什么没有两个下拉列表。1-4和第二个值的第1个下拉列表。