Tutorial [Lớp học lập trình] Bài 3: Project SSH All In One - Part 1 2 3

Split(new tring [] {Environment.NewLine} ,StringSplitOptions.None);

có thể thay bằng

Split('\n');


được không bạn ?
 
XHBWVQL.png

Mình làm y hệt video mà sao lại bị lỗi này nhỉ? @tunvit
 
bài này khó hiểu hơn mấy bài trước nhiều, chắc mấy bạn đang ôn lại kiến thức cũ :)
 
Tất nhiên sẽ được, bài sau trong khi làm mình sẽ nói về class. Yên tâm là sẽ có đầy đủ các kiến thức tương đương bậc cao đẳng hoặc các giáo trình hiện hành. Chỉ là mình ko thích dạy theo lối mòn, rất nhàm chán, thay vì vậy chúng ta cứ làm project, trong lúc làm đụng tới cái nào dạy cái đó, từ từ sẽ biết hết ;)
đúng rồi anh, em cũng đang học IT nhưng ở trường dạy rất là chán + buồn ngủ nên em chả bao giờ đụng tới, thời gian rãnh roàn mò AutoIT vì nó thực tiễn hơn nhiều, bây giờ nhờ có anh mà em có hứng thú lại với C,C#,C++,... Cảm ơn a nhiều nhiều :D:D
 
bác này có nhận dạy lập trình auto it...học phí tùy anh inbox..nhận ít đệ tử ..hì hì..em chỉ biết sơ sơ về C# còn lại đầu trống rỗng :):);););)
 
nộp bài phát
1449952__nh_ch_p_m_n_h_nh_2015.png
8500247__nh_ch_p_m_n_h_nh_2015.png
 
Last edited:
Mọi người cho mình hỏi là mình làm sai chỗ nào mà nó không lọc được SSH hư vậy ?
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SSH_All_In_One
{
  public partial class Form1 : Form
  {
  public Form1()
  {
  InitializeComponent();
  }
  private void Form1_Load(object sender, EventArgs e)
  {

  }
  private void richTextBox1_TextChanged(object sender, EventArgs e)
  {

  }
  private void richTextBox2_TextChanged(object sender, EventArgs e)
  {

  }
  private void label1_Click(object sender, EventArgs e)
  {

  }
  private void label2_Click(object sender, EventArgs e)
  {

  }   
  private void label3_Click(object sender, EventArgs e)
  {

  }
  private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  {
  //if (comboBox1.SelectedIndex == 0)
  //{
  //  MessageBox.Show("Loc SSH hu !");
  //}
  //else if (comboBox1.SelectedIndex == 1)
  //{
  //  MessageBox.Show("Loc SSH trung ca user va password");
  //}
  }
  private void button1_Click(object sender, EventArgs e)
  {
  if(cbTacVu.SelectedIndex == 0)
  {
  Loc_SSH_Hu();
  }
  else
  {
  MessageBox.Show("Cac chuc nang khac se som co :)");
  }
  //MessageBox.Show("Thuc hien tac vu");
  }
  public void Loc_SSH_Hu()
  {
  string[] danh_sach_Nhap_Vap = txtDauVao.Text.Trim().Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
  for (int i = 0; i < danh_sach_Nhap_Vap.Length; i++)
  {
  string ssh = danh_sach_Nhap_Vap[i];
  if (string.IsNullOrEmpty(ssh) == false)
  {
  string[] ssh_Array = ssh.Split('|');
  if (ssh_Array.Length >= 3)
  {
  txtDauRa.Text += ssh + Environment.NewLine;
  //MessageBox.Show("SSH" + ssh + "la SSH loi");
  }
  }
  }
  }
  }
}
 
Mọi người cho mình hỏi là mình làm sai chỗ nào mà nó không lọc được SSH hư vậy ?
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace SSH_All_In_One
{
  public partial class Form1 : Form
  {
  public Form1()
  {
  InitializeComponent();
  }
  private void Form1_Load(object sender, EventArgs e)
  {

  }
  private void richTextBox1_TextChanged(object sender, EventArgs e)
  {

  }
  private void richTextBox2_TextChanged(object sender, EventArgs e)
  {

  }
  private void label1_Click(object sender, EventArgs e)
  {

  }
  private void label2_Click(object sender, EventArgs e)
  {

  }  
  private void label3_Click(object sender, EventArgs e)
  {

  }
  private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
  {
  //if (comboBox1.SelectedIndex == 0)
  //{
  //  MessageBox.Show("Loc SSH hu !");
  //}
  //else if (comboBox1.SelectedIndex == 1)
  //{
  //  MessageBox.Show("Loc SSH trung ca user va password");
  //}
  }
  private void button1_Click(object sender, EventArgs e)
  {
  if(cbTacVu.SelectedIndex == 0)
  {
  Loc_SSH_Hu();
  }
  else
  {
  MessageBox.Show("Cac chuc nang khac se som co :)");
  }
  //MessageBox.Show("Thuc hien tac vu");
  }
  public void Loc_SSH_Hu()
  {
  string[] danh_sach_Nhap_Vap = txtDauVao.Text.Trim().Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
  for (int i = 0; i < danh_sach_Nhap_Vap.Length; i++)
  {
  string ssh = danh_sach_Nhap_Vap[i];
  if (string.IsNullOrEmpty(ssh) == false)
  {
  string[] ssh_Array = ssh.Split('|');
  if (ssh_Array.Length >= 3)
  {
  txtDauRa.Text += ssh + Environment.NewLine;
  //MessageBox.Show("SSH" + ssh + "la SSH loi");
  }
  }
  }
  }
  }
}
dòng này
Code:
string[] danh_sach_Nhap_Vap = txtDauVao.Text.Trim().Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
nên thay bằng dòng này dễ hiểu hơn
Code:
string[] danh_sach_Nhap_Vap = richTextBox1.Text.Trim().Split(Environment.NewLine.ToCharArray());
 
dòng này
Code:
string[] danh_sach_Nhap_Vap = txtDauVao.Text.Trim().Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
nên thay bằng dòng này dễ hiểu hơn
Code:
string[] danh_sach_Nhap_Vap = richTextBox1.Text.Trim().Split(Environment.NewLine.ToCharArray());
String[] danh_sach_Nhap_Vap = richTextBox1.Lines();

ngắn gọn xúc tích :D
 

Announcements

Today's birthdays

Forum statistics

Threads
418,793
Messages
7,076,423
Members
170,875
Latest member
noithatthietke
Back
Top Bottom