如何在沒有運行整個項目的情況下在多個winforms項目中運行單個winform?以多種形式在項目內部調試單個winform
using System.Data;
using System.Drawing;
using System.Linq;
using Syncfusion.Windows.Forms;
namespace Desktop
{
public partial class WarnaForm : MetroForm
{
private DataTable table;
public WarnaForm()
{
InitializeComponent();
_initializeData();
_initializeGridGrouping();
}
private void _initializeData()
{
table = getTable();
/*
using (HMERPEntities context = new HMERPEntities())
{
var queryDaftarSemuaWarna = context.warna;
foreach (var w in queryDaftarSemuaWarna.ToList())
{
DataRow rowNew = table.NewRow();
rowNew["No"] = w.warna_id;
rowNew["Nama"] = w.nama;
table.Rows.Add(rowNew);
table.AcceptChanges();
}
}*/
}
public DataTable getTable()
{
DataTable table = new DataTable();
table.Columns.Add("No", typeof (long));
table.Columns.Add("Nama", typeof (string));
return table;
}
private void _initializeGridGrouping()
{
gridGroupingControl1.DataSource = table;
}
}
}
對於沒有連接到數據庫的winform,我這樣做是通過使用Immidiate窗口: Immidiate Window
但是當我把我的代碼與實體框架連接(取消註釋EF部分) ,它給了我一個錯誤 Immidiate Window with error
類型的第一次機會異常'System.Threading.ThreadAbortException'發生在 EntityFramework.dll評估需要一個線程臨時運行。 使用觀察窗口執行評估。
千恩萬謝,
PS: 我使用: - 視覺工作室CE 2013 - C#和.NET版本的WinForms 4.5 - Windows 7的
更改您的啓動窗體? – Jeremy
是否存在拋出異常的特定屬性?嘗試在返回值之前在屬性的get方法中調用'Debugger.NotifyOfCrossThreadDependency();' – Peter
[Evaluation可能重複需要一個線程臨時運行。使用Watch窗口執行評估](http://stackoverflow.com/questions/4280604/evaluation-requires-a-thread-to-run-temporarilyuse-the-watch-window-toper-perform) –