我正在尝试构建一个简单的应用程序,它将根据提供的一组术语要求输入。它从单击一个按钮开始:
protected void InventoryMoveButton_Click(object sender, EventArgs e)
{
DataDisplay.Text = "Inventory Move:";
isDataStringMode = false;
InstructionsLabel.Text = InventoryInstructions; //displays instruction text
InventoryMove();
}
其中显示一些文本和电话InventoryMove()
。
void InventoryMove()
{
string[] keyList = { "FROM", "TO", "QUANTITY" }; //moving from somewhere to somewhere
DataDisplay.Text = "hello from inventory move"; //this is a textbox
BuildScreen("Inventory Move", BuildKeyList(keyList));
}
该方法提供了一个术语列表,它需要用户向该方法提供值BuildScreen()
。BuildKeyList()
只需将这些条款放入BuildScreen()
接受的 ArrayList 中。BuildScreen()
定义如下:
void BuildScreen(string action, ArrayList listOfKeys)
{
int input;
DataDisplay.Text += "lol hi from BuildScreen";
//DataTextBox.Text = "";
DataDisplay.Text = action + "\n";
//dataValues.Clear(); //empty previous values as they are not part of the current operation
foreach (string key in listOfKeys)
{
DataDisplay.Text += key + ": ";
input = readValidNumber();
DataDisplay.Text += input + "\n";
dataValues.Add(key, input);
}
}
我遇到的问题是,单击按钮后,InstructionsLabel
您在我的第一段代码中看到的文本永远不会改变。所以看起来代码在那一点上挂了,但这可能只是在文本有机会改变之前在其他地方引起的错误。为什么单击按钮时此代码会挂起?