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 DATApplication { public partial class frmMerge : Form { public frmMerge(String[] datfile1)//DataGridView dgv) { InitializeComponent(); strfile = datfile1; } String[] strfile; private void btnMerge_Click(object sender, EventArgs e) { DataGridViewTextBoxColumn dgvctime = new DataGridViewTextBoxColumn(); dgvctime.Name = cmbColumn1.Text; dgvctime.HeaderText = cmbColumn1.Text; dataGridView1.Columns.Add(dgvctime); //dataGridView1.Rows.Add(dgvctime); int rowadded = 0; for (int RowCount = 1; RowCount <= strfile.Length - 1; RowCount++) { if (strfile[RowCount].ToString() != " ") { if (RowCount != 0) { //dataGridView1.Rows.Add(); string[] column = strfile[RowCount].Split('þ'); rowadded = 0; for (int i = 1; i < column.Length - 1; i++) { //dataGridView1.Rows.Add(); if ((cmbColumn1.SelectedIndex == ((i - 1) / 2)) || (cmbColumn2.SelectedIndex == ((i - 1) / 2))) { if (rowadded == 0) { rowadded = 1; dataGridView1.Rows.Add(); } if (column[i].ToString() != "\u0014") { dataGridView1.Rows[RowCount - 1].Cells[cmbColumn1.Text].Value += " "+column[i].ToString(); } } } } } } } private void button1_Click(object sender, EventArgs e) { ClsSaveDat Savdat = new ClsSaveDat(); Savdat.SaveDat(dataGridView1); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)