C#表格立即关闭
问题描述:
突然我的表单窗口在应用程序启动后就开始关闭。输出窗口中没有任何提示可能导致它的提示,也没有发生任何错误。有人有任何想法吗?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 = "";
}
}
}
答
明显的第一件事 - 在调试模式下运行它,并停止对所有异常执行。这应该给你足够的信息如何从那里去。
否则Functions funcs = new Functions();
看起来很可疑。
+0
是函数funcs = new Functions();有什么问题 – donstack 2013-03-13 18:04:46
明显的问题,但在调试时抛出任何异常? – 2013-03-13 16:59:44
做调试>例外 - 停止在抛出的异常 – pm100 2013-03-13 17:00:59