我有一个mdi父表单,我在运行时以mdi子表单的形式打开我的其他表单:
private void winAppToolStripMenuItem_Click(object sender, EventArgs e)
{
Upload objWA = new Upload();
objWA.MdiParent = this;
objWA.Show();
//objWA.WindowState = FormWindowState.Maximized;
}
private void userInfoToolStripMenuItem_Click(object sender, EventArgs e)
{
Reports objUI = new Reports();
objUI.MdiParent = this;
objUI.Show();
//objUI.WindowState = FormWindowState.Maximized;
}
但问题是:当前表单打开时,用户可以打开另一个表单,并且可以重复多次,以便打开每个表单,以便在用户打开新的子表单之前关闭上一个子表单的代码? / p>
答案 0 :(得分:0)
public void DisposeAllButThis(Form form){
foreach (Form frm in this.MdiChildren)
{
if (frm.GetType() == form.GetType()
&& frm != form)
{
frm.Dispose();
frm.Close();
}
}}
得到了这个: C# loop through all MDI childer and close all other forms except the current
答案 1 :(得分:0)
try {
JSONArray jarr=new JSONArray(response); // response is whole json response
for (int i=0;i<jarr.length();i++){
JSONObject jobj=jarr.getJSONObject(i);
String primary_photo=jobj.getString("primary_photo");
}
} catch (JSONException e) {
e.printStackTrace();
}
让我知道它是否有效,因为我刚刚完成了