L
LamSoft
It seems that my program is dead lock after running this sentence (bold)
private delegate void updateBuildingDetailCallBack(String key, String Value);
private void updateBuildingDetail(String key, String Value)
{
if (tabBuildings.Controls["lblBuild_Resource_" + key].InvokeRequired)
{
// This is not a UI thread, we cannot update the UI directly
updateBuildingDetailCallBack callBack = delegate(String _key, String _Value)
{
tabBuildings.Controls["lblBuild_Resource_" + _key].Text = _Value;
};
tabBuildings.Controls["lblBuild_Resource_" + key].Invoke(callBack, new object[] { key, Value });
}
else
{
tabBuildings.Controls["lblBuild_Resource_" + key].Text = Value;
}
}
When I try to debug the program, if the program first time calling the function "updateBuildingDetail", the objects of tabBuildings.Controls["lblBuild_Resource_" + key] is still need to be invoked while normally for the first time it doesn't
May I know why cause the program hang after the bolded statement?
Thanks
private delegate void updateBuildingDetailCallBack(String key, String Value);
private void updateBuildingDetail(String key, String Value)
{
if (tabBuildings.Controls["lblBuild_Resource_" + key].InvokeRequired)
{
// This is not a UI thread, we cannot update the UI directly
updateBuildingDetailCallBack callBack = delegate(String _key, String _Value)
{
tabBuildings.Controls["lblBuild_Resource_" + _key].Text = _Value;
};
tabBuildings.Controls["lblBuild_Resource_" + key].Invoke(callBack, new object[] { key, Value });
}
else
{
tabBuildings.Controls["lblBuild_Resource_" + key].Text = Value;
}
}
When I try to debug the program, if the program first time calling the function "updateBuildingDetail", the objects of tabBuildings.Controls["lblBuild_Resource_" + key] is still need to be invoked while normally for the first time it doesn't
May I know why cause the program hang after the bolded statement?
Thanks