Click here to Skip to main content
15,895,656 members
Articles / Programming Languages / C#

CSV Filter

Rate me:
Please Sign up or sign in to vote.
4.72/5 (10 votes)
27 Sep 2009CPOL2 min read 46.2K   1.1K   20  
How to read, filter and write your CSV files
namespace CSV_Filter
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
            this.txtSource = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.label2 = new System.Windows.Forms.Label();
            this.txtTarget = new System.Windows.Forms.TextBox();
            this.btnFilter = new System.Windows.Forms.Button();
            this.lnkSourceBrowse = new System.Windows.Forms.LinkLabel();
            this.lnkTargetBrowse = new System.Windows.Forms.LinkLabel();
            this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
            this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
            this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();
            this.progressBar1 = new System.Windows.Forms.ProgressBar();
            this.lblStatus = new System.Windows.Forms.Label();
            this.lblPBValue = new System.Windows.Forms.Label();
            this.txtSourceSeperator = new System.Windows.Forms.TextBox();
            this.label3 = new System.Windows.Forms.Label();
            this.numTokens = new System.Windows.Forms.NumericUpDown();
            this.label4 = new System.Windows.Forms.Label();
            this.label5 = new System.Windows.Forms.Label();
            this.txtTargetSeperator = new System.Windows.Forms.TextBox();
            this.label6 = new System.Windows.Forms.Label();
            this.txtFilter = new System.Windows.Forms.TextBox();
            this.cmbFilter = new System.Windows.Forms.ComboBox();
            this.chUnique = new System.Windows.Forms.CheckBox();
            this.lnkAbout = new System.Windows.Forms.LinkLabel();
            ((System.ComponentModel.ISupportInitialize)(this.numTokens)).BeginInit();
            this.SuspendLayout();
            // 
            // txtSource
            // 
            this.txtSource.Location = new System.Drawing.Point(62, 15);
            this.txtSource.Name = "txtSource";
            this.txtSource.Size = new System.Drawing.Size(180, 20);
            this.txtSource.TabIndex = 0;
            // 
            // label1
            // 
            this.label1.AutoSize = true;
            this.label1.Location = new System.Drawing.Point(12, 18);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(44, 13);
            this.label1.TabIndex = 1;
            this.label1.Text = "Source:";
            // 
            // label2
            // 
            this.label2.AutoSize = true;
            this.label2.Location = new System.Drawing.Point(13, 46);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(43, 13);
            this.label2.TabIndex = 3;
            this.label2.Text = "Target:";
            // 
            // txtTarget
            // 
            this.txtTarget.Location = new System.Drawing.Point(62, 43);
            this.txtTarget.Name = "txtTarget";
            this.txtTarget.Size = new System.Drawing.Size(180, 20);
            this.txtTarget.TabIndex = 2;
            // 
            // btnFilter
            // 
            this.btnFilter.Location = new System.Drawing.Point(357, 131);
            this.btnFilter.Name = "btnFilter";
            this.btnFilter.Size = new System.Drawing.Size(83, 23);
            this.btnFilter.TabIndex = 4;
            this.btnFilter.Text = "&Filter";
            this.btnFilter.UseVisualStyleBackColor = true;
            this.btnFilter.Click += new System.EventHandler(this.btnFilter_Click);
            // 
            // lnkSourceBrowse
            // 
            this.lnkSourceBrowse.AutoSize = true;
            this.lnkSourceBrowse.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
            this.lnkSourceBrowse.LinkColor = System.Drawing.Color.SteelBlue;
            this.lnkSourceBrowse.Location = new System.Drawing.Point(248, 18);
            this.lnkSourceBrowse.Name = "lnkSourceBrowse";
            this.lnkSourceBrowse.Size = new System.Drawing.Size(42, 13);
            this.lnkSourceBrowse.TabIndex = 5;
            this.lnkSourceBrowse.TabStop = true;
            this.lnkSourceBrowse.Text = "Browse";
            this.lnkSourceBrowse.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkSourceBrowse_LinkClicked);
            // 
            // lnkTargetBrowse
            // 
            this.lnkTargetBrowse.AutoSize = true;
            this.lnkTargetBrowse.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
            this.lnkTargetBrowse.LinkColor = System.Drawing.Color.SteelBlue;
            this.lnkTargetBrowse.Location = new System.Drawing.Point(248, 46);
            this.lnkTargetBrowse.Name = "lnkTargetBrowse";
            this.lnkTargetBrowse.Size = new System.Drawing.Size(42, 13);
            this.lnkTargetBrowse.TabIndex = 6;
            this.lnkTargetBrowse.TabStop = true;
            this.lnkTargetBrowse.Text = "Browse";
            this.lnkTargetBrowse.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkTargetBrowse_LinkClicked);
            // 
            // openFileDialog1
            // 
            this.openFileDialog1.Filter = "CSV Files|*.csv";
            // 
            // saveFileDialog1
            // 
            this.saveFileDialog1.Filter = "CSV Files|*.csv";
            // 
            // backgroundWorker1
            // 
            this.backgroundWorker1.WorkerReportsProgress = true;
            this.backgroundWorker1.DoWork += new System.ComponentModel.DoWorkEventHandler(this.backgroundWorker1_DoWork);
            this.backgroundWorker1.RunWorkerCompleted += new System.ComponentModel.RunWorkerCompletedEventHandler(this.backgroundWorker1_RunWorkerCompleted);
            this.backgroundWorker1.ProgressChanged += new System.ComponentModel.ProgressChangedEventHandler(this.backgroundWorker1_ProgressChanged);
            // 
            // progressBar1
            // 
            this.progressBar1.Location = new System.Drawing.Point(14, 136);
            this.progressBar1.Name = "progressBar1";
            this.progressBar1.Size = new System.Drawing.Size(282, 10);
            this.progressBar1.TabIndex = 7;
            // 
            // lblStatus
            // 
            this.lblStatus.AutoSize = true;
            this.lblStatus.Location = new System.Drawing.Point(12, 120);
            this.lblStatus.Name = "lblStatus";
            this.lblStatus.Size = new System.Drawing.Size(29, 13);
            this.lblStatus.TabIndex = 3;
            this.lblStatus.Text = "Idle.";
            // 
            // lblPBValue
            // 
            this.lblPBValue.AutoSize = true;
            this.lblPBValue.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            this.lblPBValue.Location = new System.Drawing.Point(313, 136);
            this.lblPBValue.Name = "lblPBValue";
            this.lblPBValue.Size = new System.Drawing.Size(27, 13);
            this.lblPBValue.TabIndex = 3;
            this.lblPBValue.Text = "0%";
            // 
            // txtSourceSeperator
            // 
            this.txtSourceSeperator.Location = new System.Drawing.Point(399, 17);
            this.txtSourceSeperator.Name = "txtSourceSeperator";
            this.txtSourceSeperator.Size = new System.Drawing.Size(41, 20);
            this.txtSourceSeperator.TabIndex = 8;
            this.txtSourceSeperator.Text = ",";
            // 
            // label3
            // 
            this.label3.AutoSize = true;
            this.label3.Location = new System.Drawing.Point(334, 21);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(59, 13);
            this.label3.TabIndex = 3;
            this.label3.Text = "Seperator:";
            // 
            // numTokens
            // 
            this.numTokens.Location = new System.Drawing.Point(201, 84);
            this.numTokens.Maximum = new decimal(new int[] {
            30,
            0,
            0,
            0});
            this.numTokens.Name = "numTokens";
            this.numTokens.Size = new System.Drawing.Size(41, 20);
            this.numTokens.TabIndex = 9;
            this.numTokens.Value = new decimal(new int[] {
            2,
            0,
            0,
            0});
            // 
            // label4
            // 
            this.label4.AutoSize = true;
            this.label4.Location = new System.Drawing.Point(150, 88);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(45, 13);
            this.label4.TabIndex = 3;
            this.label4.Text = "Tokens:";
            // 
            // label5
            // 
            this.label5.AutoSize = true;
            this.label5.Location = new System.Drawing.Point(334, 49);
            this.label5.Name = "label5";
            this.label5.Size = new System.Drawing.Size(59, 13);
            this.label5.TabIndex = 3;
            this.label5.Text = "Seperator:";
            // 
            // txtTargetSeperator
            // 
            this.txtTargetSeperator.Location = new System.Drawing.Point(399, 45);
            this.txtTargetSeperator.Name = "txtTargetSeperator";
            this.txtTargetSeperator.Size = new System.Drawing.Size(41, 20);
            this.txtTargetSeperator.TabIndex = 8;
            this.txtTargetSeperator.Text = ",";
            // 
            // label6
            // 
            this.label6.AutoSize = true;
            this.label6.Location = new System.Drawing.Point(248, 88);
            this.label6.Name = "label6";
            this.label6.Size = new System.Drawing.Size(31, 13);
            this.label6.TabIndex = 3;
            this.label6.Text = "Filter";
            // 
            // txtFilter
            // 
            this.txtFilter.Location = new System.Drawing.Point(399, 85);
            this.txtFilter.Name = "txtFilter";
            this.txtFilter.Size = new System.Drawing.Size(41, 20);
            this.txtFilter.TabIndex = 8;
            this.txtFilter.Text = "@";
            // 
            // cmbFilter
            // 
            this.cmbFilter.FormattingEnabled = true;
            this.cmbFilter.Items.AddRange(new object[] {
            "Contains",
            "Dosn\'t Contain"});
            this.cmbFilter.Location = new System.Drawing.Point(285, 85);
            this.cmbFilter.Name = "cmbFilter";
            this.cmbFilter.Size = new System.Drawing.Size(108, 21);
            this.cmbFilter.TabIndex = 10;
            this.cmbFilter.Text = "Contains";
            this.cmbFilter.SelectedIndexChanged += new System.EventHandler(this.cmbFilter_SelectedIndexChanged);
            // 
            // chUnique
            // 
            this.chUnique.AutoSize = true;
            this.chUnique.Location = new System.Drawing.Point(15, 87);
            this.chUnique.Name = "chUnique";
            this.chUnique.Size = new System.Drawing.Size(112, 17);
            this.chUnique.TabIndex = 11;
            this.chUnique.Text = "Get unique values";
            this.chUnique.UseVisualStyleBackColor = true;
            // 
            // lnkAbout
            // 
            this.lnkAbout.AutoSize = true;
            this.lnkAbout.LinkBehavior = System.Windows.Forms.LinkBehavior.HoverUnderline;
            this.lnkAbout.LinkColor = System.Drawing.Color.SteelBlue;
            this.lnkAbout.Location = new System.Drawing.Point(13, 149);
            this.lnkAbout.Name = "lnkAbout";
            this.lnkAbout.Size = new System.Drawing.Size(36, 13);
            this.lnkAbout.TabIndex = 6;
            this.lnkAbout.TabStop = true;
            this.lnkAbout.Text = "About";
            this.lnkAbout.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.lnkAbout_LinkClicked);
            // 
            // Form1
            // 
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(452, 166);
            this.Controls.Add(this.chUnique);
            this.Controls.Add(this.cmbFilter);
            this.Controls.Add(this.numTokens);
            this.Controls.Add(this.txtTargetSeperator);
            this.Controls.Add(this.txtFilter);
            this.Controls.Add(this.txtSourceSeperator);
            this.Controls.Add(this.progressBar1);
            this.Controls.Add(this.lnkAbout);
            this.Controls.Add(this.lnkTargetBrowse);
            this.Controls.Add(this.lnkSourceBrowse);
            this.Controls.Add(this.btnFilter);
            this.Controls.Add(this.lblPBValue);
            this.Controls.Add(this.lblStatus);
            this.Controls.Add(this.label4);
            this.Controls.Add(this.label5);
            this.Controls.Add(this.label6);
            this.Controls.Add(this.label3);
            this.Controls.Add(this.label2);
            this.Controls.Add(this.txtTarget);
            this.Controls.Add(this.label1);
            this.Controls.Add(this.txtSource);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "Form1";
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
            this.Text = "CSV Filter";
            ((System.ComponentModel.ISupportInitialize)(this.numTokens)).EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();

        }

        #endregion

        private System.Windows.Forms.TextBox txtSource;
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.TextBox txtTarget;
        private System.Windows.Forms.Button btnFilter;
        private System.Windows.Forms.LinkLabel lnkSourceBrowse;
        private System.Windows.Forms.LinkLabel lnkTargetBrowse;
        private System.Windows.Forms.OpenFileDialog openFileDialog1;
        private System.Windows.Forms.SaveFileDialog saveFileDialog1;
        private System.ComponentModel.BackgroundWorker backgroundWorker1;
        private System.Windows.Forms.ProgressBar progressBar1;
        private System.Windows.Forms.Label lblStatus;
        private System.Windows.Forms.Label lblPBValue;
        private System.Windows.Forms.TextBox txtSourceSeperator;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.NumericUpDown numTokens;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.Label label5;
        private System.Windows.Forms.TextBox txtTargetSeperator;
        private System.Windows.Forms.Label label6;
        private System.Windows.Forms.TextBox txtFilter;
        private System.Windows.Forms.ComboBox cmbFilter;
        private System.Windows.Forms.CheckBox chUnique;
        private System.Windows.Forms.LinkLabel lnkAbout;
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Retired QSoft
Yemen Yemen
Biography?! I'm not dead yet!
www.QSoftOnline.com

Comments and Discussions