Advertisement
tuan6956

Untitled

Aug 9th, 2015
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.28 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApplication5
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.             InitializeComponent();
  18.         }
  19.  
  20.         private void label2_Click(object sender, EventArgs e)
  21.         {
  22.  
  23.         }
  24.  
  25.         private void Form1_Load(object sender, EventArgs e)
  26.         {
  27.  
  28.         }
  29.  
  30.         private void BTclick_Click(object sender, EventArgs e)
  31.         {
  32.             if (tacvu1.Checked == true)
  33.             {
  34.                 Loc_SSH_loi();
  35.             }
  36.             if (tacvu2.Checked == true)
  37.             {
  38.                 loc_ssh_trung_toan_bo();
  39.             }
  40.         }
  41.  
  42.         private void cbtacvu_SelectedIndexChanged(object sender, EventArgs e)
  43.         {
  44.             //if (cbtacvu.SelectedIndex ==0)
  45.             //{
  46.             //    Loc_SSH_loi();
  47.             //}
  48.         }
  49.         public void Loc_SSH_loi()
  50.         {
  51.             string[] danh_sach_nhap_vao = txtdauvao.Text.Trim().Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
  52.             for (int i = 0; i < danh_sach_nhap_vao.Length; i++)
  53.             {
  54.                 string ssh = danh_sach_nhap_vao[i];
  55.                 if (string.IsNullOrEmpty(ssh) == false)
  56.                 {
  57.                     string[] ssh_nhap_vao = ssh.Split('|');
  58.                     if (ssh_nhap_vao.Length > 3)
  59.                     {
  60.                         txtdaura.Text += ssh + Environment.NewLine;
  61.                     }
  62.                 }
  63.             }
  64.         }
  65.         public void loc_ssh_trung_toan_bo()
  66.         {
  67.          List<string> list_ssh = new List<string>();
  68.          string[] danh_sach_nhap_vao = txtdauvao.Text.Trim().Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
  69.          for (int i=0; i< danh_sach_nhap_vao.Length; i++)
  70.          {
  71.             string ssh = danh_sach_nhap_vao[i];
  72.             if (list_ssh.Contains(ssh) == false)
  73.             {
  74.                 list_ssh.Add(ssh);
  75.             }
  76.          }
  77.          txtdaura.Text = string.Join(Environment.NewLine, list_ssh);
  78.         }
  79.  
  80.     }
  81. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement