C#表格即刻关闭

时间:2013-03-13 16:59:09

标签: c#

一旦应用程序启动,我的表单窗口就会开始关闭。输出窗口中没有任何内容可以提示可能导致它的原因,也没有任何错误。有没有人有任何想法?

我已经提供了表格。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ProjectBoardManagement {
  public partial class CreateBoard : Form {

    Functions funcs = new Functions();

    public CreateBoard() {
      InitializeComponent();
    }

    private void CreateBoardButton_Click(object sender, EventArgs e) {
      String BoardName = BoardNameText.Text;
      String Pages = "";
      String Labels = "";
      foreach (ListViewItem i in PageNameList.Items) {
        Pages = (Pages + i.Name.ToString() + ",");
      }

      foreach (ListViewItem i in LabelNameList.Items) {
        Labels = (Labels + i.Name.ToString() + ",");
      }

      String BoardFile = ("board_" + BoardName + ".txt");
      funcs.SaveSetting(BoardFile, "name", BoardName);
      funcs.SaveSetting(BoardFile, "pages", Pages);
      funcs.SaveSetting(BoardFile, "labels", Labels);

      FormManagement.CreateBoard.Hide();
      FormManagement.BoardList.LoadBoardList();
    }

    private void PageNameButtonAdd_Click(object sender, EventArgs e) {
      String pagename = PageNameText.Text;
      if (pagename != "") {
        PageNameList.Items.Add(pagename);
      }
      PageNameText.Text = "";
    }

    private void LabelNameButtonAdd_Click(object sender, EventArgs e) {
      String labelname = LabelNameText.Text;
      if (labelname != "") {
        LabelNameList.Items.Add(labelname);
      }
      LabelNameText.Text = "";
    }
  }
}

1 个答案:

答案 0 :(得分:0)

明显要做的第一件事 - 在调试模式下运行它并停止对所有异常执行。这应该给你足够的信息,如何去那里。

否则Functions funcs = new Functions();看起来很可疑。