hep me c#!

Thảo luận trong 'C#' bắt đầu bởi toanit0392, 10 Tháng mười hai 2011.

  1. Offline

    toanit0392

    • Windows 1.0

    Số bài viết:
    80
    Đã được thích:
    14
    Điểm thành tích:
    10
    if (openFileDialog1.ShowDialog() == DialogResult.OK)//
    {
    FileStream fs = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read);
    StreamReader st_r = new StreamReader(fs);
    st_r.BaseStream.Seek(0, SeekOrigin.Begin);
    string strLine = st_r.ReadLine();
    int bd = 0;
    while (strLine != null)
    {
    int a = strLine.IndexOf("\t", bd);//không hiểu
    string str1 = strLine.Substring(0, a);
    //.Substring(0, a) có nghĩa là sao?
    bd = a + 1;//vị trí ỏ chỗ nào?
    int b = strLine.IndexOf("\t", bd);
    //.IndexOf("\t", bd) có nghĩa là sao trời?
    string str2 = strLine.Substring(bd, b - bd);// không hiểu .Substring(bd, b - bd) ý là sao ?
    bd = b + 1;// vị trí ỏ chỗ nào
    string str3 = strLine.Substring(bd);

    ListViewItem lvi = new ListViewItem(new string[] { str1, str2, str3});
    listView1.Items.Add(lvi);

    strLine = st_r.ReadLine();
    }
    st_r.Close();

    đây là phần code open cua 1 form..
    ai biết giải thích dùm mình mấy câu lênh này với,chú ý chữ màu đỏ và lí giải dùm chữ màu xanh..thank!
    chú thích :vì mảng này có 3 cột nên chỉ có { str1, str2, str3}
    đề này hơi khó hy vọng mọi người giúp được..thank!

Chia sẻ trang này

Advertising: Linux system admin | nukeviet | nukeviet 4 | Upload ảnh miễn phí