0
private void label16_MouseEnter(object sender, EventArgs e)
{
panelSummary.Show();
StockInfo temp = Game.getStockByLabelName(label16.Text);
// StockComp.Text = "Stock Company = " + temp.getStockName();// I got errors in this line
lbDispStockPrice.Text = "Stock price = " + temp.getPrice();
lbDispStock.Text = "Stock category = " + temp.getCategory();
owner.Text = "Property Of " + temp.getBuyer();
}
大概'getStockByLabelName'已經返回null ...你需要找出原因。 –
當這不是C時,爲什麼你在這裏有一個「c」標籤,並且哪一行會拋出錯誤?您正在引用的對象之一(panelSummary,Game,temp等)爲空。你是否通過調試器來查看哪一個? – OldProgrammer
我接下來的建議是啓動一個調試器來查看語句中哪個變量出錯是'null'。 – millimoose