private void btnReadMicr_Click(object sender, EventArgs e)
        {
            DetectMICR BankMICR = new DetectMICR();
            Dictionary <string, byte[]> files = new Dictionary <string, byte[]>();

            char[] charsToTrim = { 'A', 'B', 'C', 'D' };

            foreach (string fileName in Directory.GetFiles(txtPath.Text))
            {
                string VMicr = BankMICR.DetectMICRLine(fileName);
                Application.DoEvents();
                if (VMicr.Length == 36)
                {
                    int rowId = dgvMICR.Rows.Add();


                    DataGridViewRow row = dgvMICR.Rows[rowId];

                    var AccountNo = VMicr.Substring(18, 13).ToString().Trim(charsToTrim);
                    var Mask      = "####-######-##-#";


                    row.Cells[0].Value = VMicr.Substring(13, 4).ToString();
                    row.Cells[1].Value = VMicr.Substring(1, 8).ToString();
                    row.Cells[2].Value = WithMask(AccountNo, Mask);
                    row.Cells[3].Value = VMicr.Substring(32, 3).ToString();
                    row.Cells[4].Value = Path.GetFileName(fileName);
                }
            }
        }
Exemple #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            DetectMICR BankMICR = new DetectMICR();
            string     VMicr    = BankMICR.DetectMICRLine("D:\\MICRLine2.TIF");


            MessageBox.Show(VMicr.ToString());
        }