2012-12-14 2 views
0

Sharp Develop 4.2를 사용하는 .NET 4.0이 설치된 Windows 7 컴퓨터에서 C#으로 프로그램을 작성했습니다. 그런 다음 Sharp Develop에서 릴리스로 변경하고 빌드 한 다음 bin \ Release 폴더의 .exe를 .NET 4.0이 설치된 다른 Windows 7 컴퓨터로 복사했습니다. 초기 폼을로드하지 않고 즉시 충돌하고 특정 오류를주지 않습니다. 내 MainForm 메서드는 다음과 같습니다.exe가 다른 컴퓨터에 복사 될 때 프로그램이 충돌합니다

using System; 
using System.Collections.Generic; 
using System.Drawing; 
using System.Windows.Forms; 
using System.Data; 
using System.Data.SqlClient; 
using System.ComponentModel; 
using System.Globalization; 
using System.IO; 
using System.Drawing.Printing; 
using System.Diagnostics; 
using System.Text; 

namespace BiasTracker1._ 
{ 
public partial class MainForm : Form 
{ 
//Here are my initial variables 

public static SqlConnectionStringBuilder sqlBldr = new SqlConnectionStringBuilder(); 
public static DataSet ds = new DataSet(); 
public static DataTable DisplayTable = ds.Tables.Add("DisplayTable"); 
SqlDataAdapter RawDataDA; 
SqlCommandBuilder RawSampleSCB; 
public static DataTable InstrumentDetail = ds.Tables.Add("InstrumentDetail"); 
public static string DatabaseOwner; 
System.Windows.Forms.DataVisualization.Charting.Chart CurrentChart; 
public static DataTable ImportDataTable = new DataTable(); 
public static string NewTransfer; 
public static bool ValidatePerCell = true; 
public static Image chart1Image; 
public static string Title; 
public static string NIRLabString; 
bool ChangesNotDisplayed = false; 
Point PreviousChartLocation; 
List<System.Windows.Forms.DataVisualization.Charting.DataPoint> SelectedPoints = new List<System.Windows.Forms.DataVisualization.Charting.DataPoint>(); 
List<DataRow> SelectedRows = new List<DataRow>(); 
static double EPS = 2.22045e-016; 
double FPMIN = 2.22507e-308/EPS; 
public static CustomPrintDoc pd = new CustomPrintDoc(); 
int NumOfParametersInReport = 0; 
public static SqlConnectionStringBuilder SimPlusConn; 
public static string SimPlusProductGUID; 
public static string SimPlusSiteCode; 
public double[] cof = new double[] {-1.3026537197817904,0.64196979235649026,0.019476473204185836,-0.009561514786808631,-0.000946595344482036,0.000366839497852761,0.000042523324806907,-0.000020278578112534,-0.000001624290004647,0.00000130365583558,0.000000015626441722,-0.000000085238095915,0.000000006529054439,0.000000005059343495,-0.000000000991364156,-0.000000000227365122,0.000000000096467911,0.000000000002394038,-0.000000000006886027,0.000000000000894487,0.000000000000313092,-0.000000000000112708,0.000000000000000381,0.000000000000007106,-0.000000000000001523,-0.000000000000000094,0.000000000000000121,-0.000000000000000028}; 
Point? prevPosition = null; 
ToolTip tooltip = new ToolTip(); 

public MainForm() 
{ 
    try 
    { 
      InitializeComponent(); 
    } 
    catch(Exception ex) 
    { 
      MessageBox.Show("Failed in Initialization.\n" + ex.ToString()); 
    } 
    //Test SQL Connection 
    FileStream ConnectionStream; 
    try 
    { 
      ConnectionStream = new FileStream(@"C:\BiasTracker\settings.ini",FileMode.OpenOrCreate); 
    } 
    catch(DirectoryNotFoundException ex) 
    { 
      MessageBox.Show("Not able to find ini... Creating one."); 
      Directory.CreateDirectory(@"C:\BiasTracker"); 
      ConnectionStream = new FileStream(@"C:\BiasTracker\settings.ini",FileMode.OpenOrCreate); 
    } 
    try 
    { 
      StreamReader ConnectionRdr = new StreamReader(ConnectionStream); 
      string line = null; 
      if((line = ConnectionRdr.ReadLine()) != null) 
      { 
       sqlBldr.DataSource = line; 
       sqlBldr.Password = ConnectionRdr.ReadLine(); 
       sqlBldr.UserID = ConnectionRdr.ReadLine(); 
       sqlBldr.InitialCatalog = ConnectionRdr.ReadLine(); 
      } 
      else 
      { 
       sqlBldr.DataSource = ".\\SQLEXPRESS"; 
       sqlBldr.Password = "password"; 
       sqlBldr.UserID = "sa"; 
       sqlBldr.InitialCatalog = "BiasMaster"; 
       StreamWriter ConnectionWtr = new StreamWriter(ConnectionStream); 
       ConnectionWtr.WriteLine(".\\SQLEXPRESS"); 
       ConnectionWtr.WriteLine("password"); 
       ConnectionWtr.WriteLine("sa"); 
       ConnectionWtr.WriteLine("BiasMaster"); 
       ConnectionWtr.WriteLine("applications\\SQLEXPRESS"); 
       ConnectionWtr.WriteLine("password"); 
       ConnectionWtr.WriteLine("sa"); 
       ConnectionWtr.WriteLine("BiasMaster"); 
       ConnectionWtr.Dispose(); 
      } 
      ConnectionStream.Close(); 
      ConnectionStream.Dispose(); 
      ConnectionRdr.Dispose(); 
    } 
    catch(Exception ex) 
    { 
      MessageBox.Show("Not Able to read connection string\n" + ex.ToString()); 
    } 
    System.Data.SqlClient.SqlConnection tmpConn; 
    tmpConn = new SqlConnection(sqlBldr.ConnectionString); 
    try     //Test the connection and existence of the database 
    { 
      tmpConn.Open(); 
      tmpConn.Close(); 
    } 
    catch 
    { 
      MessageBox.Show("Database Connection not Found."); 
      tmpConn.Close(); 
    } 

    SqlDataAdapter SettingsDA = new SqlDataAdapter("SELECT * FROM Settings WHERE SettingDesc = 'Owner'",sqlBldr.ConnectionString); 
    DataTable SettingsTable = new DataTable(); 
    SettingsDA.Fill(SettingsTable); 
    DatabaseOwner = SettingsTable.Rows[0][1].ToString(); 

    MakeTreeView(); 

} 

MakeTreeView는 메시지 상자에 try catch로 둘러싸여 있습니다.

나의 양식은 이러한 컨트롤을로드 : 내가 생각할 수있는

privateSystem.Windows.Forms.ToolStripMenuItemsimPlusImportToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripStatusLabeltoolStripStatusLabel1; 
privateSystem.Windows.Forms.ToolStripMenuItemsyncWithSharedServerToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemsyncToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemsetDBConnectionToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemtestToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemdetectOutliersToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemsaveToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemexcludeSelectedToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemgraphActionsToolStripMenuItem; 
privateSystem.Windows.Forms.ComboBoxcomboBox7; 
privateSystem.Windows.Forms.ToolStripMenuItemprintReportToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemaddToReportToolStripMenuItem; 
privateSystem.Windows.Forms.DataVisualization.Charting.Chartchart4; 
privateSystem.Windows.Forms.DataVisualization.Charting.Chartchart3; 
privateSystem.Windows.Forms.Panelpanel2; 
privateSystem.Windows.Forms.DataVisualization.Charting.Chartchart2; 
privateSystem.Windows.Forms.ComboBoxcomboBox6; 
privateSystem.Windows.Forms.Labellabel7; 
privateSystem.Windows.Forms.Buttonbutton3; 
privateSystem.Windows.Forms.DataVisualization.Charting.Chartchart1; 
privateSystem.Windows.Forms.Buttonbutton2; 
privateSystem.Windows.Forms.ToolStripMenuItemremoveProductFormInstrumentToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemcopyInstrumentProductListToAnotherInstrumentToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemaddProductToInstrumentToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemaddParameterToProductToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemtablesToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemtXTToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemcSVToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItembiasDataToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemimportToolStripMenuItem; 
privateSystem.Windows.Forms.Labellabel1; 
privateSystem.Windows.Forms.ComboBoxcomboBox1; 
privateSystem.Windows.Forms.Labellabel2; 
privateSystem.Windows.Forms.ComboBoxcomboBox2; 
privateSystem.Windows.Forms.Labellabel3; 
privateSystem.Windows.Forms.ComboBoxcomboBox3; 
privateSystem.Windows.Forms.Labellabel4; 
privateSystem.Windows.Forms.ComboBoxcomboBox4; 
privateSystem.Windows.Forms.Labellabel5; 
privateSystem.Windows.Forms.ComboBoxcomboBox5; 
privateSystem.Windows.Forms.Labellabel6; 
privateSystem.Windows.Forms.DateTimePickerdateTimePicker1; 
privateSystem.Windows.Forms.DateTimePickerdateTimePicker2; 
privateSystem.Windows.Forms.ToolStripMenuItemparameterToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemproductToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuIteminstrumentToolStripMenuItem1; 
privateSystem.Windows.Forms.ToolStripMenuItemlocationToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemcompanyToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemnewToolStripMenuItem; 
privateSystem.Windows.Forms.ToolStripMenuItemfileToolStripMenuItem; 
privateSystem.Windows.Forms.MenuStripmenuStrip1; 
privateSystem.Windows.Forms.StatusStripstatusStrip1; 
privateSystem.Windows.Forms.TabPagetabPage2; 
privateSystem.Windows.Forms.DataGridViewdataGridView1; 
privateSystem.Windows.Forms.TreeViewtreeView1; 
privateSystem.Windows.Forms.Buttonbutton1; 
privateSystem.Windows.Forms.Panelpanel1; 
privateSystem.Windows.Forms.TabPagetabPage1; 
privateSystem.Windows.Forms.TabControltabControl1; 

유일한 것은 내가 다른 컴퓨터에 액세스 할 수없는 무언가에 대한 참조를 사용하고 있다는 점이다. 차트 컨트롤이라고 생각했지만 .NET 4.0에는 포함되어 있습니다. 어떤 도움이라도 대단히 감사 할 것입니다.

+0

"특별한 오류가 없습니다"? 전혀 오류가 있습니까? –

+0

필자는 Windows 7에 조금 익숙하지 않지만 xp에서 오류보고 화면을 보내는 것과 동일하다고 생각합니다. 나는 그것이 나에게 주었던 모든 정보를 따라 갔지만 어떤 세부 사항도 찾을 수 없었다. 내 프로그램의 이름. 당신이 어디를보아야하는지 알면, 나는 더 많은 정보를 줄 수있을 것입니다. – AThomack

답변