-2

应用程序启动后,我的表单窗口突然开始关闭。输出窗口中没有任何内容可以提示可能导致它的原因,也没有向我抛出任何错误。有人有什么想法吗?

我已经提供给form的班级。

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 = "";
    }
  }
}
4

1 回答 1

0

显而易见的第一件事 - 在调试模式下运行它并停止所有异常的执行。这应该为您提供有关如何从那里开始的足够信息。

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

于 2013-03-13T17:03:57.490 回答