Example #1
0
    private bool LoadFileToDataTable(string path)
    {
        string[][] csvTable = FileUtility.LoadFileToCsv(path);
        if (csvTable == null)
        {
            return(false);
        }

        // csv->DataTable
        try
        {
            m_DataTable     = ConvertUtility.CsvToDataTable(csvTable);
            m_CopyDataTable = m_DataTable.Copy();

            m_DataGridView.DataSource = m_DataTable;

            UpdateGridHeader();
            LoadLayout();
            MainForm.Instance.UpdateCellEdit();

            m_DataGridView.CellValueChanged += OnDataGridView_CellValueChanged;
            EditManager.DoSomething         += OnRedoUndo_DoSomethingChange;
        }
        catch (Exception ex)
        {
            DebugUtility.ShowExceptionMessageBox("csv转DataTable失败:" + path, ex);
            return(false);
        }
        return(true);
    }